🐛 fix(auth.py): decrease ACCESS_TOKEN_EXPIRE_MINUTES to 1 minute for faster token expiration

🐛 fix(API/index.ts): add null check for response object in updateFlowInDatabase function to prevent potential error
🐛 fix(formModal/index.tsx): close chat and websocket connection when user is redirected to login page
This commit is contained in:
Cristhian Zanforlin Lousa 2023-09-27 23:51:24 -03:00
commit b76dfba5a0
2 changed files with 11 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import { AxiosResponse } from "axios";
import axios, { AxiosResponse } from "axios";
import { ReactFlowJsonObject } from "reactflow";
import { BASE_URL_API } from "../../constants/constants";
import { api } from "../../controllers/API/api";
@ -146,8 +146,8 @@ export async function updateFlowInDatabase(
description: updatedFlow.description,
});
if (response.status !== 200) {
throw new Error(`HTTP error! status: ${response.status}`);
if (response?.status !== 200) {
throw new Error(`HTTP error! status: ${response?.status}`);
}
return response.data;
} catch (error) {
@ -522,4 +522,4 @@ export async function deleteApiKey(api_key: string) {
console.log("Error:", error);
throw error;
}
}
}

View file

@ -156,6 +156,13 @@ export default function FormModal({
function handleOnClose(event: CloseEvent): void {
if (isOpen.current) {
//check if the user has been logged out, if so close the chat when the user is redirected to the login page
if (window.location.href.includes("login")) {
setOpen(false);
ws.current?.close();
return;
}
getBuildStatus(flow.id)
.then((response) => {
if (response.data.built) {