Minor refactor

pull/8286/head
Puru Vijay 4 years ago
parent 7fbe7b706a
commit b660ba796a

@ -11,15 +11,15 @@
$page.url.hash.replace('#', '').startsWith(val.path.split('/').at(-1)) $page.url.hash.replace('#', '').startsWith(val.path.split('/').at(-1))
); );
if (!section) goto('/docs/introduction'); if (!section) return '/docs/introduction';
// Remove the section name from hash, then redirect to that // Remove the section name from hash, then redirect to that
const hash = $page.url.hash.replace(`#${section.path.split('/').at(-1)}-`, ''); const hash = $page.url.hash.replace(`#${section.path.split('/').at(-1)}-`, '');
goto(`${section.path}#${hash}`); return `${section.path}#${hash}`;
} }
onMount(() => { onMount(() => {
getURlToRedirectTo(); goto(getURlToRedirectTo());
}); });
</script> </script>

Loading…
Cancel
Save