diff --git a/app/routes/login.tsx b/app/routes/login.tsx index b5e725b..b095974 100644 --- a/app/routes/login.tsx +++ b/app/routes/login.tsx @@ -18,8 +18,8 @@ export async function loader({ request }: LoaderFunctionArgs) { return redirect('/machines', { headers: { // eslint-disable-next-line @typescript-eslint/naming-convention - 'Set-Cookie': await commitSession(session) - } + 'Set-Cookie': await commitSession(session), + }, }) } @@ -35,7 +35,7 @@ export async function loader({ request }: LoaderFunctionArgs) { const data = { oidc: issuer, - apiKey: normal === undefined + apiKey: normal === undefined, } if (!data.oidc && !data.apiKey) { @@ -82,21 +82,21 @@ export async function action({ request }: ActionFunctionArgs) { session.set('hsApiKey', apiKey) session.set('user', { name: key.prefix, - email: `${expiresDays} days` + email: `${expiresDays.toString()} days`, }) return redirect('/machines', { headers: { // eslint-disable-next-line @typescript-eslint/naming-convention 'Set-Cookie': await commitSession(session, { - maxAge: expiresIn - }) - } + maxAge: expiresIn, + }), + }, }) } catch (error) { console.error(error) return json({ - error: 'Invalid API key' + error: 'Invalid API key', }) } } @@ -107,61 +107,69 @@ export default function Page() { const showOr = useMemo(() => data.oidc && data.apiKey, [data]) return ( -
{actionData.error}
+ ) + : undefined} +