Skip to content

Commit

Permalink
issue 62
Browse files Browse the repository at this point in the history
  • Loading branch information
jho44 authored and lilith committed Sep 26, 2023
1 parent a4a1736 commit 6beafbb
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 6beafbb

Please sign in to comment.