Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49227

Ionic-vue, problem with route replacement

$
0
0

I’m trying to build a login screen with ionic-vue, I was expecting the user for not having access to go back to the login screen once the token has stored in the storage and redirected to the home page.

My authentication logic is as simple as this:

setup() {
  const router = useRouter()

  async function onSuccess(response: AxiosResponse): Promise<void> {
    await Storage.set({ key: 'token', value: response.data.token })
    const token = await Storage.get({ key: 'token' })

    if (token) router.replace({ name: 'home' })
    else throw new Error("Couldn't set token.")
  }
}

On web environment, the back button (that one beside the address bar) behaves properly which is good. However, on mobile (native, both iOS and Android), when I swipe the screen, it redirecting me back to the login screen.

Is there any kind of method to prevent this behavior?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49227

Trending Articles