Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
try0 committed Jul 18, 2023
1 parent bcea153 commit 407b426
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
11 changes: 0 additions & 11 deletions spa-example/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@
import github from 'svelte-awesome/icons/github';
import { goto } from '$app/navigation';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
onMount(() => {
window.addEventListener('beforeunload', (e: BeforeUnloadEvent) => {
e.preventDefault();
e.returnValue = null;
goto(window.location.pathname);
return false;
});
});
</script>

<div class="app" data-theme="light">
Expand Down
7 changes: 1 addition & 6 deletions spa-example/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import { page } from '$app/stores';
import { onMount } from 'svelte';
onMount(() => {
let pathname: string | null = $page.url.searchParams.get('ref');
if (pathname && !pathname.includes("404")) {
goto(pathname + "?r=1");
}
});
</script>

<svelte:head>
Expand Down
8 changes: 1 addition & 7 deletions spa-example/static/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

<head>
<script>

let referer = window.location.referer;
let to = "/sveltekit-example";
if (referer) {
to += "?ref=" + new URL(referer).pathname;
}
window.location.href = to
window.location.href = "/sveltekit-example";
</script>
</head>

Expand Down

0 comments on commit 407b426

Please sign in to comment.