update
This commit is contained in:
@@ -2,10 +2,6 @@ import type { Route } from './+types'
|
||||
|
||||
import { parse } from 'cookie'
|
||||
|
||||
export const OK = 200
|
||||
export const FOUND = 302
|
||||
export const INTERNAL_SERVER_ERROR = 500
|
||||
|
||||
export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
const cookies = parse(request.headers.get('Cookie') || '')
|
||||
const url = new URL(request.url)
|
||||
@@ -16,7 +12,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
|
||||
if (!cookies?.__session) {
|
||||
return new Response(null, {
|
||||
status: FOUND,
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: loginUrl.toString()
|
||||
}
|
||||
@@ -33,7 +29,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
redirect: 'manual'
|
||||
})
|
||||
|
||||
if (r.status === FOUND) {
|
||||
if (r.status === 302) {
|
||||
return new Response(await r.text(), {
|
||||
status: r.status,
|
||||
headers: r.headers
|
||||
@@ -47,7 +43,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
})
|
||||
|
||||
// Deny authorization if user lacks scopes requested by client
|
||||
if (r.status === FOUND) {
|
||||
if (r.status === 302) {
|
||||
return new Response(null, {
|
||||
status: r.status,
|
||||
headers: {
|
||||
@@ -57,13 +53,13 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
}
|
||||
|
||||
return new Response(null, {
|
||||
status: FOUND,
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: loginUrl.toString()
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return new Response(null, { status: INTERNAL_SERVER_ERROR })
|
||||
return new Response(null, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export async function action({ request, context }: Route.ActionArgs) {
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return Response.json({}, { status: INTERNAL_SERVER_ERROR })
|
||||
return Response.json({}, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export default function Layout() {
|
||||
aria-hidden="true"
|
||||
className="absolute inset-0 grid grid-cols-2 opacity-20"
|
||||
>
|
||||
<div className="blur-[106px] h-56 bg-gradient-to-br to-lime-400 from-lime-700"></div>
|
||||
<div className="blur-[106px] h-42 bg-gradient-to-r from-lime-400 to-lime-600"></div>
|
||||
<div className="blur-[106px] h-56 bg-linear-to-br to-lime-400 from-lime-700"></div>
|
||||
<div className="blur-[106px] h-42 bg-linear-to-r from-lime-400 to-lime-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user