svelte-hash-router icon indicating copy to clipboard operation
svelte-hash-router copied to clipboard

Question: how to do redirect in code?

Open guillemc opened this issue 4 years ago • 1 comments

Hi! Is it possible to force a redirect inside a component's script tag? (for example, if the user is not logged in, redirect to /login)

guillemc avatar Mar 30 '20 08:03 guillemc

@guillemc It seems like you can assign a string to location.hash. Correct me if there is a better way...

location.hash = '/login'

dbrockman avatar Apr 06 '20 12:04 dbrockman