So I have a session storage value set to false that I need to keep track of for the user session that is managed by Vuex. I set up the value right from the main.js file as such:
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import axios from 'axios';
import store from './store'
createApp(App).use(store).use(router).mount('#app')
sessionStorage.setItem('session', false);
App.prototype.$http = axios
And I was wondering whether it was ok to do it as such right from main.js file or if vuzI should do it elsewhere, such as in App.vue.
Thanks in advance
CodePudding user response:
that's ok,the code runs well, you can use sessionStorage.setItem
anywhere,because this is a synchronous method. if it goes badly, there must be something wrong with the logic of the code, i need more clues.