Skip to content

Commit

Permalink
refactor: /private to /app
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed May 28, 2024
1 parent 847a4fc commit e4af94c
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ const authGuard: Handle = async ({ event, resolve }) => {
event.locals.session = session
event.locals.user = user

if (!event.locals.session && event.url.pathname.startsWith("/private")) {
if (!event.locals.session && event.url.pathname.startsWith("/app")) {
return redirect(303, "/auth")
}

if (event.locals.session && event.url.pathname === "/auth") {
return redirect(303, "/private")
return redirect(303, "/app")
}

return resolve(event)
Expand Down
4 changes: 2 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<a class="btn btn-primary w-full" href="/auth">
Authenticate
</a>
<a class="btn btn-outline w-full" href="/private">
Private
<a class="btn btn-outline w-full" href="/app">
Go to App
</a>
</div>
<ul>
Expand Down
3 changes: 1 addition & 2 deletions src/routes/api/auth/confirm/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export const GET: RequestHandler = async ({ url, locals: { supabase } }) => {

/**
* Clean up the redirect URL by deleting the Auth flow parameters.
*
* `next` is preserved for now, because it"s needed in the error case.
* `next` is preserved for now, because it's needed in the error case.
*/
const redirectTo = new URL(url)
redirectTo.pathname = next
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions src/routes/auth/+layout.svelte

This file was deleted.

0 comments on commit e4af94c

Please sign in to comment.