mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
feat(rnd): Route to /login on authenticated requests (#8111)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user