<script lang="ts">
  import { page } from '$app/state';

  let target = page.url.searchParams.get('next') ?? '/';
  if (new URL(target, page.url.href).host !== page.url.host) target = '/';
</script>

<svelte:head>
  <meta http-equiv="refresh" content="0.1; url={target}" />
</svelte:head>

<h2 class="text-xl">Redirecting...</h2>
<p>If nothing happens, click <a href={target}>here</a>.</p>
