feat: refactor/reorganize auth routes

This commit is contained in:
Aarnav Tale 2024-12-08 13:27:51 -05:00
parent 9d64a5beac
commit 50e43bc0c3
No known key found for this signature in database
7 changed files with 102 additions and 66 deletions

View file

@ -1,15 +0,0 @@
import { type ActionFunctionArgs, redirect } from '@remix-run/node'
import { destroySession, getSession } from '~/utils/sessions'
export async function action({ request }: ActionFunctionArgs) {
const session = await getSession(request.headers.get('Cookie'))
const returnTo = new URL(request.url).pathname
return redirect(`/login?returnTo=${returnTo}`, {
headers: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'Set-Cookie': await destroySession(session)
}
})
}