0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-01 17:32:39 +00:00
VueTube/NUXT/store/tweaks/index.js

31 lines
922 B
JavaScript
Raw Normal View History

2022-03-21 05:13:21 +00:00
export const state = () => ({
2022-03-21 23:47:11 +00:00
roundTweak: 0,
roundThumb: true,
roundWatch: true,
2022-03-21 23:47:11 +00:00
});
2022-03-21 05:13:21 +00:00
export const mutations = {
2022-03-21 23:47:11 +00:00
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;
state.roundThumb = localStorage.getItem("roundThumb") || true;
state.roundWatch = localStorage.getItem("roundWatch") || true;
2022-03-21 05:13:21 +00:00
}
2022-03-21 23:47:11 +00:00
},
setRoundTweak(state, payload) {
if (!isNaN(payload)) {
state.roundTweak = payload;
localStorage.setItem("roundTweak", payload);
}
},
setRoundThumb(state, payload) {
state.roundThumb = payload;
localStorage.setItem("roundThumb", payload);
},
setRoundWatch(state, payload) {
state.roundWatch = payload;
localStorage.setItem("roundWatch", payload);
},
2022-03-21 23:47:11 +00:00
};