NuxtN
Nuxt2y ago
Ross

Redirect to route on value.

I need to integrate with an exisiting system and that will pass information using local store. Because I am using Pinia I am reading the local stor and hydrating Pinia and would then like to redirect to the appropiate route based on a value in local store. I am using CSR
const testStore = useTestStore();

// Read from localstorage
const testToken = ref(getItem('testToken'));
// Save it in Pinia
testStore.setTestToken(testToken);

const targetRoute = ref(getItem('target'));

// How can I redirect to a route based on the contants of target ?
Was this page helpful?