🔧 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,
|
||||
login: () => {},
|
||||
logout: () => {},
|
||||
refreshAccessToken: () => Promise.resolve(),
|
||||
userData: null,
|
||||
setUserData: () => {},
|
||||
getAuthentication: () => false,
|
||||
|
|
@ -98,29 +97,6 @@ export function AuthProvider({ children }): React.ReactElement {
|
|||
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 (
|
||||
// !! to convert string to boolean
|
||||
|
|
@ -133,7 +109,6 @@ export function AuthProvider({ children }): React.ReactElement {
|
|||
refreshToken,
|
||||
login,
|
||||
logout,
|
||||
refreshAccessToken,
|
||||
setUserData,
|
||||
userData,
|
||||
getAuthentication,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
processDBData(DbData);
|
||||
updateStateWithDbData(DbData);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -152,7 +151,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
processFlowEdges(flow);
|
||||
processFlowNodes(flow);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -486,7 +484,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
return id;
|
||||
} catch (error) {
|
||||
// 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
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ export default function GenericModal({
|
|||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
setIsEdit(true);
|
||||
return setErrorData({
|
||||
title: "There is something wrong with this prompt, please review it",
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ export default function ApiKeysPage() {
|
|||
data={api_keys.id}
|
||||
index={index}
|
||||
onConfirm={(index, keys) => {
|
||||
console.log(keys);
|
||||
handleDeleteKey(keys);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ export type AuthContextType = {
|
|||
refreshToken: string | null;
|
||||
login: (accessToken: string, refreshToken: string) => void;
|
||||
logout: () => void;
|
||||
refreshAccessToken: (refreshToken: string) => Promise<void>;
|
||||
userData: Users | null;
|
||||
setUserData: (userData: Users | null) => void;
|
||||
getAuthentication: () => boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue