diff options
| author | Adam Soltys <[email protected]> | 2022-10-04 00:42:00 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-10-04 00:42:00 -0700 |
| commit | 81fc48aa58d932a19fb578e47170c06b3992d03a (patch) | |
| tree | 30b06d929a175f0e74ef1da87e3d474f9068ad6c /src/routes/+layout.svelte | |
| parent | 63f1a6780bab85ebb48ca1fc142cc6beaf772faa (diff) | |
| download | coinos-ui-81fc48aa58d932a19fb578e47170c06b3992d03a.tar.gz coinos-ui-81fc48aa58d932a19fb578e47170c06b3992d03a.zip | |
refactoring
Diffstat (limited to 'src/routes/+layout.svelte')
| -rw-r--r-- | src/routes/+layout.svelte | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 118caa48..a07d2fb1 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -15,6 +15,8 @@ export let data; let { user, rate: r, token, rates } = data; + $: update(data); + let update = () => ({ user, rate: r, token, rates } = data); $rate = r; $: $selectedRate = user && $rate * (rates[user.currency] / rates.USD); @@ -26,16 +28,9 @@ locale.subscribe((lng) => { if (lng) localStorage.setItem(localeLocalStorageKey, lng); }); - - if (protectedRoutes.find((p) => $page.url.pathname.match(p))) { - if (!token) { - goto('/login'); - warning($t('error.signIn')); - } - } - - connect(token); }); + + $: browser && connect(token); </script> <SvelteToast options={{ reversed: true, intro: { y: 192 } }} /> |
