Utils

Utensils

  1. isValidEmail
  2. A utility function for validating email addresses.

    svelte
    Loading...
  3. handleRedirect
  4. The best way to demonstrate its usage is with a Sign In/Sign Up scenario. Assume you are on page X and want to navigate to page Y, but accessing page Y requires you to be logged in.

    handleRedirect takes a base route and a target route, along with any parameters, to construct a complete route and then navigate to it.

    Please note that it is your responsibility to read the redirectTo parameter on the login page. Below are several examples of how to use handleRedirect in different scenarios.

    svelte
    Loading...

    Basic redirect

    http://localhost:5173/login?redirectTo=%2Fmanage%2Fuser

    svelte
    Loading...

    Param heavy redirect

    http://localhost:5173/login?condition_1=test&condition_2=test&redirectTo=%2Fmanage%2Fuser%3Fstatus%3Dtest%26passed%3Dtrue

    svelte
    Loading...

    Simple hard redirect

    By default, handleRedirect uses goto, hence the optional options param replaceState: true. However, if you need a hard redirect, you can use the useHardRedirect option.

    svelte
    Loading...
Edit Page

Last Updated: -

© 2026 @sierra-95/svelte-scaffold. All rights reserved.