mirror of https://github.com/buster-so/buster.git
supabase docs are wrong. dead wrong.
This commit is contained in:
parent
fcaaddef5d
commit
809f2751ea
|
@ -6,7 +6,7 @@ import { redirect } from 'next/navigation';
|
|||
|
||||
export async function GET(request: NextRequest) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const token_hash = searchParams.get('token_hash');
|
||||
const token_hash = searchParams.get('token_hash') || searchParams.get('code'); //THE SUPABASE DOCS ARE WRONG!
|
||||
const type = searchParams.get('type') as EmailOtpType | null;
|
||||
const next = searchParams.get('next') ?? '/';
|
||||
|
||||
|
|
|
@ -3,15 +3,28 @@
|
|||
import { useCallback } from 'react';
|
||||
import { signOut } from '@/lib/supabase/signOut';
|
||||
import { clearAllBrowserStorage } from '@/lib/browser/storage';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { BusterRoutes } from '@/routes/busterRoutes';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
|
||||
export const useSignOut = () => {
|
||||
const onChangePage = useAppLayoutContextSelector((x) => x.onChangePage);
|
||||
const { openErrorMessage } = useBusterNotifications();
|
||||
const handleSignOut = useCallback(async () => {
|
||||
// First clear all client-side storage
|
||||
clearAllBrowserStorage();
|
||||
try {
|
||||
// Then perform server-side sign out
|
||||
await signOut();
|
||||
|
||||
// Then perform server-side sign out
|
||||
await signOut();
|
||||
}, []);
|
||||
// First clear all client-side storage
|
||||
clearAllBrowserStorage();
|
||||
|
||||
await onChangePage({
|
||||
route: BusterRoutes.AUTH_LOGIN
|
||||
});
|
||||
} catch (error) {
|
||||
openErrorMessage('Error signing out');
|
||||
}
|
||||
}, [onChangePage, openErrorMessage]);
|
||||
|
||||
return handleSignOut;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue