VueTube/NUXT/store/tweaks/index.js

18 lines
549 B
JavaScript
Raw Normal View History

2022-03-21 05:13:21 +00:00
export const state = () => ({
roundTweak: 0
})
export const mutations = {
initTweaks(state) {
// NOTE: localStorage is not reactive, so it will only be used on first load
// currently called beforeCreate() in pages/default.vue
if (process.client) {
state.roundTweak = localStorage.getItem("roundTweak") || 0
}
},
setRoundTweak (state, payload) {
if (!isNaN(payload)) {
state.roundTweak = payload
localStorage.setItem("roundTweak", payload)
}
}
}