Skip to content

Commit

Permalink
change href with redirectDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
DarianM committed Oct 27, 2024
1 parent 75518e8 commit 4fd9604
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/frontend/app/routes/auth._index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Form } from '@remix-run/react'
import { Button } from '../components/ui'
import variables from '../lib/envConfig.server'
import { checkAuthAndRedirect } from '../lib/kratos_checks.server'
import { type LoaderFunctionArgs } from '@remix-run/node'
import { redirectDocument, type LoaderFunctionArgs } from '@remix-run/node'

export const loader = async ({ request }: LoaderFunctionArgs) => {
const cookies = request.headers.get('cookie')
Expand All @@ -10,8 +11,13 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
return null
}

export const action = () => {
return redirectDocument(
`${variables.kratosBrowserPublicUrl}/self-service/login/browser`
);
};

export default function Auth() {
const loginUrl = `${variables.kratosBrowserPublicUrl}/self-service/login/browser`
return (
<div className='pt-4 flex flex-col'>
<div className='flex flex-col rounded-md bg-offwhite px-6 text-center min-h-[calc(100vh-7rem)] md:min-h-[calc(100vh-3rem)]'>
Expand All @@ -33,9 +39,11 @@ export default function Auth() {
</a>
</p>
<div>
<Button aria-label='logout' href={loginUrl} className='mr-2'>
Login
</Button>
<Form method="post">
<Button aria-label='logout' type='submit' className='mr-2'>
Login
</Button>
</Form>
</div>
</div>
</div>
Expand Down

0 comments on commit 4fd9604

Please sign in to comment.