🔧 fix(authContext.tsx): remove unused refreshAccessToken function to improve code readability and maintainability
🔧 fix(tabsContext.tsx): remove unnecessary console.error statements to improve code readability and maintainability 🔧 fix(genericModal/index.tsx): remove unnecessary console.log statement to improve code readability and maintainability 🔧 fix(ApiKeysPage/index.tsx): remove unnecessary console.log statement to improve code readability and maintainability 🔧 fix(auth.ts): remove unused refreshAccessToken function type to improve code readability and maintainability
This commit is contained in:
parent
a154955154
commit
0a2ced4e60
5 changed files with 0 additions and 31 deletions
|
|
@ -13,7 +13,6 @@ const initialValue: AuthContextType = {
|
||||||
refreshToken: null,
|
refreshToken: null,
|
||||||
login: () => {},
|
login: () => {},
|
||||||
logout: () => {},
|
logout: () => {},
|
||||||
refreshAccessToken: () => Promise.resolve(),
|
|
||||||
userData: null,
|
userData: null,
|
||||||
setUserData: () => {},
|
setUserData: () => {},
|
||||||
getAuthentication: () => false,
|
getAuthentication: () => false,
|
||||||
|
|
@ -98,29 +97,6 @@ export function AuthProvider({ children }): React.ReactElement {
|
||||||
setIsAuthenticated(false);
|
setIsAuthenticated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshAccessToken(refreshToken: string) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("/api/refresh-token", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ refreshToken }),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
const data = await response.json();
|
|
||||||
login(data.accessToken, refreshToken);
|
|
||||||
getLoggedUser().then((user) => {
|
|
||||||
console.log("oi");
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
logout();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
logout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// !! to convert string to boolean
|
// !! to convert string to boolean
|
||||||
|
|
@ -133,7 +109,6 @@ export function AuthProvider({ children }): React.ReactElement {
|
||||||
refreshToken,
|
refreshToken,
|
||||||
login,
|
login,
|
||||||
logout,
|
logout,
|
||||||
refreshAccessToken,
|
|
||||||
setUserData,
|
setUserData,
|
||||||
userData,
|
userData,
|
||||||
getAuthentication,
|
getAuthentication,
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
processDBData(DbData);
|
processDBData(DbData);
|
||||||
updateStateWithDbData(DbData);
|
updateStateWithDbData(DbData);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -152,7 +151,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
processFlowEdges(flow);
|
processFlowEdges(flow);
|
||||||
processFlowNodes(flow);
|
processFlowNodes(flow);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -486,7 +484,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
return id;
|
return id;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle the error if needed
|
// Handle the error if needed
|
||||||
console.error("Error while adding flow:", error);
|
|
||||||
throw error; // Re-throw the error so the caller can handle it if needed
|
throw error; // Re-throw the error so the caller can handle it if needed
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,6 @@ export default function GenericModal({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
|
||||||
setIsEdit(true);
|
setIsEdit(true);
|
||||||
return setErrorData({
|
return setErrorData({
|
||||||
title: "There is something wrong with this prompt, please review it",
|
title: "There is something wrong with this prompt, please review it",
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,6 @@ export default function ApiKeysPage() {
|
||||||
data={api_keys.id}
|
data={api_keys.id}
|
||||||
index={index}
|
index={index}
|
||||||
onConfirm={(index, keys) => {
|
onConfirm={(index, keys) => {
|
||||||
console.log(keys);
|
|
||||||
handleDeleteKey(keys);
|
handleDeleteKey(keys);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ export type AuthContextType = {
|
||||||
refreshToken: string | null;
|
refreshToken: string | null;
|
||||||
login: (accessToken: string, refreshToken: string) => void;
|
login: (accessToken: string, refreshToken: string) => void;
|
||||||
logout: () => void;
|
logout: () => void;
|
||||||
refreshAccessToken: (refreshToken: string) => Promise<void>;
|
|
||||||
userData: Users | null;
|
userData: Users | null;
|
||||||
setUserData: (userData: Users | null) => void;
|
setUserData: (userData: Users | null) => void;
|
||||||
getAuthentication: () => boolean;
|
getAuthentication: () => boolean;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue