🐛 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:
parent
0fc7e2ee47
commit
b76dfba5a0
2 changed files with 11 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { AxiosResponse } from "axios";
|
import axios, { AxiosResponse } from "axios";
|
||||||
import { ReactFlowJsonObject } from "reactflow";
|
import { ReactFlowJsonObject } from "reactflow";
|
||||||
import { BASE_URL_API } from "../../constants/constants";
|
import { BASE_URL_API } from "../../constants/constants";
|
||||||
import { api } from "../../controllers/API/api";
|
import { api } from "../../controllers/API/api";
|
||||||
|
|
@ -146,8 +146,8 @@ export async function updateFlowInDatabase(
|
||||||
description: updatedFlow.description,
|
description: updatedFlow.description,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.status !== 200) {
|
if (response?.status !== 200) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response?.status}`);
|
||||||
}
|
}
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -522,4 +522,4 @@ export async function deleteApiKey(api_key: string) {
|
||||||
console.log("Error:", error);
|
console.log("Error:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -156,6 +156,13 @@ export default function FormModal({
|
||||||
|
|
||||||
function handleOnClose(event: CloseEvent): void {
|
function handleOnClose(event: CloseEvent): void {
|
||||||
if (isOpen.current) {
|
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)
|
getBuildStatus(flow.id)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.built) {
|
if (response.data.built) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue