ATProto forum built with ESAV

callback redirect

rimar1337 54126436 2ff6b79a

Changed files
+5 -1
src
providers
routes
callback
+1
.gitignore
··· 7 7 .env 8 8 .nitro 9 9 .tanstack 10 + public/client-metadata.json
+1
src/providers/OAuthProvider.tsx
··· 66 66 67 67 const startLogin = useCallback(async (handleOrPdsUrl: string) => { 68 68 if (status !== 'signedOut') return; 69 + sessionStorage.setItem('postLoginRedirect', window.location.pathname + window.location.search); 69 70 try { 70 71 await oauthClient.signIn(handleOrPdsUrl); 71 72 } catch (err) {
+3 -1
src/routes/callback/index.tsx
··· 6 6 7 7 function RouteComponent() { 8 8 const navigate = useNavigate() 9 - navigate({to:"/"}) 9 + const redirectPath = sessionStorage.getItem('postLoginRedirect') || '/'; 10 + navigate({to:redirectPath}) 11 + sessionStorage.removeItem('postLoginRedirect'); 10 12 return <div>Hello "/callback/"!</div> 11 13 }