fix pathname

This commit is contained in:
2026-01-20 15:21:42 -03:00
parent 0e036d0d4f
commit 2cd000c1cb
2 changed files with 43 additions and 36 deletions

View File

@@ -41,6 +41,7 @@ export const workspaceMiddleware = async (
{ params, request, context }: LoaderFunctionArgs,
next: () => Promise<Response>
): Promise<Response> => {
const url = new URL(request.url)
const user = context.get(userContext)!
const r = await req({
@@ -66,7 +67,11 @@ export const workspaceMiddleware = async (
? (workspaces.find(({ id }) => id === preferred_org_id) ?? workspaces[0])
: workspaces[0]
throw redirect(`/${fallback.id}/main`)
if (!fallback) {
throw new Response(null, { status: 403 })
}
throw redirect(`/${fallback.id}${url.pathname}`)
}
const org = (await req({