feat(rnd): Route to /login on authenticated requests (#8111)
parent
52ee846744
commit
612e7cfed5
|
@ -42,7 +42,11 @@ const ProfileDropdown = () => {
|
|||
Admin Dashboard
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem onClick={() => supabase?.auth.signOut()}>
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
supabase?.auth.signOut().then(() => router.replace("/login"))
|
||||
}
|
||||
>
|
||||
Log out
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
|
|
|
@ -195,6 +195,15 @@ export default class BaseAutoGPTServerAPI {
|
|||
response_data.detail,
|
||||
response,
|
||||
);
|
||||
|
||||
if (
|
||||
response.status === 403 &&
|
||||
response_data.detail === "Not authenticated" &&
|
||||
window // Browser environment only: redirect to login page.
|
||||
) {
|
||||
window.location.href = "/login";
|
||||
}
|
||||
|
||||
throw new Error(`HTTP error ${response.status}! ${response_data.detail}`);
|
||||
}
|
||||
return response_data;
|
||||
|
|
Loading…
Reference in New Issue