Skip to content

Commit

Permalink
feat: removed throw redirect as per docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bbtgnn committed Feb 2, 2024
1 parent 3fa6590 commit 620a172
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/routes/(auth)/login/(methods)/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { userEmailStore } from '../_lib';

export const load = async () => {
const userEmail = get(userEmailStore);
if (!userEmail) throw redirect(303, '/login');
if (!userEmail) redirect(303, '/login');
return { userEmail };
};
2 changes: 1 addition & 1 deletion src/routes/(auth)/login/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { redirect } from '@sveltejs/kit';

export const load = async () => {
// const keypair = await getKeypairPreference();
// if (Boolean(keypair)) throw redirect(303, '/wallet');
// if (Boolean(keypair)) redirect(303, '/wallet');
/**
* Note
* Temporairly commenting this, as it disrupts the user flow in /login
Expand Down
4 changes: 2 additions & 2 deletions src/routes/(protected)/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { redirect } from '@sveltejs/kit';

export const load = async () => {
const keypair = await getKeypairPreference();
if (!Boolean(keypair)) throw redirect(303, '/login');
if (!keypair) redirect(303, '/login');

const isLocked = await isAppLocked();
if (isLocked) throw redirect(303, '/unlock');
if (isLocked) redirect(303, '/unlock');
else await lockApp(); // Locking back after the user has got in
};
2 changes: 1 addition & 1 deletion src/routes/(protected)/logout/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import { lockApp } from '$lib/preferences/locked';
export const load = async () => {
await removePreference(KEYPAIR_PREFERENCES_KEY);
await lockApp();
throw redirect(303, '/login');
redirect(303, '/login');
};
2 changes: 1 addition & 1 deletion src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit';

export const load = async () => {
throw redirect(301, '/home');
redirect(301, '/home');
};

0 comments on commit 620a172

Please sign in to comment.