Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Vue - Is it fine to store a value in session storage rigth from the main.js file?

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!