Skip to content

Commit

Permalink
issue 62
Browse files Browse the repository at this point in the history
  • Loading branch information
jho44 committed Sep 25, 2023
1 parent ef4dda6 commit 39d58ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import { redirect } from '@sveltejs/kit';
export const load = (async ({ cookies, url }) => {
if (cookies.get('session')) throw redirect(307, '/dashboard');

return { phone: url.searchParams.get('phone'), status: url.searchParams.get('status') };
return {
phone: url.searchParams.get('phone') ?? cookies.get('phone'),
status: url.searchParams.get('status')
};
}) satisfies PageServerLoad;
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
}
const phone = phoneInput.getNumber();
document.cookie = `phone=${phone}`;
const res = await writeReq('/login', {
phone
});
Expand Down

0 comments on commit 39d58ed

Please sign in to comment.