fix: active nav highlight and redirect to home after login
Some checks failed
Deploy / Deploy Production (push) Has been skipped
Deploy / Cleanup Preview (push) Has been skipped
Deploy / Deploy Preview (push) Failing after 1s
CI / UI / Build (pull_request) Successful in 14s
CI / Scraper / Test (pull_request) Successful in 16s
CI / Scraper / Lint (pull_request) Successful in 19s
CI / Scraper / Build (pull_request) Successful in 15s
Some checks failed
Deploy / Deploy Production (push) Has been skipped
Deploy / Cleanup Preview (push) Has been skipped
Deploy / Deploy Preview (push) Failing after 1s
CI / UI / Build (pull_request) Successful in 14s
CI / Scraper / Test (pull_request) Successful in 16s
CI / Scraper / Lint (pull_request) Successful in 19s
CI / Scraper / Build (pull_request) Successful in 15s
This commit is contained in:
@@ -203,10 +203,16 @@
|
||||
libnovel
|
||||
</a>
|
||||
{#if data.user}
|
||||
<a href="/books" class="text-zinc-400 hover:text-zinc-100 text-sm transition-colors">
|
||||
<a
|
||||
href="/books"
|
||||
class="text-sm transition-colors {page.url.pathname.startsWith('/books') ? 'text-zinc-100 font-medium' : 'text-zinc-400 hover:text-zinc-100'}"
|
||||
>
|
||||
Library
|
||||
</a>
|
||||
<a href="/browse" class="text-zinc-400 hover:text-zinc-100 text-sm transition-colors">
|
||||
<a
|
||||
href="/browse"
|
||||
class="text-sm transition-colors {page.url.pathname.startsWith('/browse') ? 'text-zinc-100 font-medium' : 'text-zinc-400 hover:text-zinc-100'}"
|
||||
>
|
||||
Discover
|
||||
</a>
|
||||
<div class="ml-auto flex items-center gap-4">
|
||||
|
||||
@@ -8,9 +8,9 @@ const AUTH_COOKIE = 'libnovel_auth';
|
||||
const ONE_YEAR = 60 * 60 * 24 * 365;
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
// Already logged in — send to library
|
||||
// Already logged in — send to home
|
||||
if (locals.user) {
|
||||
redirect(302, '/books');
|
||||
redirect(302, '/');
|
||||
}
|
||||
return {};
|
||||
};
|
||||
@@ -51,7 +51,7 @@ export const actions: Actions = {
|
||||
maxAge: ONE_YEAR
|
||||
});
|
||||
|
||||
redirect(302, '/books');
|
||||
redirect(302, '/');
|
||||
},
|
||||
|
||||
register: async ({ request, cookies, locals }) => {
|
||||
@@ -110,6 +110,6 @@ export const actions: Actions = {
|
||||
maxAge: ONE_YEAR
|
||||
});
|
||||
|
||||
redirect(302, '/books');
|
||||
redirect(302, '/');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user