fix: remove redundant superuser only if it has never logged in (#2582)

fix: Remove redundant superuser only if it has never logged in

The code changes in `utils.py` check if the superuser exists and if it has never logged in. If both conditions are true, the superuser is deleted from the database. This improves the efficiency and security of the application.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-08 13:37:03 -03:00 • committed by GitHub
commit 7e222187e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 12 deletions

View file

@ -131,14 +131,6 @@ function ApiInterceptor() {
if (res?.data?.access_token && res?.data?.refresh_token) {
login(res?.data?.access_token);
}
if (error?.config?.headers) {
delete error.config.headers["Authorization"];
error.config.headers["Authorization"] = `Bearer ${cookies.get(
"access_token_lf",
)}`;
const response = await axios.request(error.config);
return response;
}
} catch (error) {
clearBuildVerticesState(error);
logout();

View file

@ -98,7 +98,7 @@ export const useFolderStore = create<FoldersStoreType>((set, get) => ({
if (id) {
getFolderById(id).then((res) => {
const setAllFlows = useFlowsManagerStore.getState().setAllFlows;
setAllFlows(res.flows);
setAllFlows(res?.flows);
set({ selectedFolder: res });
});
}