Skip to content

auth/local example redirectTo is not working properly #23

Open
@asonnleitner

Description

@asonnleitner

When testing the auth/local example I noticed that the redirectTo is not working properly, I
figured that the useAuth().redirectTo value gets cleared before being used.

  await $fetch("/api/auth/login", {
    method: "POST",
    body: {
      email: email,
      password: password,
    },
  });
  useAuth().redirectTo.value = null; // <-- this line
  await useAuth().updateSession();
  await navigateTo(useAuth().redirectTo.value || "/");

So the null value could maybe be set after the navigateTo call, or can possibly omitted at all, as it gets set from the auth middleware anyway.

Else, great example, thanks for sharing!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions