fix: Fixed crash on launch, when item "loop" can`t be found

This commit is contained in:
Georgiy 2023-05-08 13:33:55 +03:00
parent c0dde9a32d
commit d358d74bc4
1 changed files with 4 additions and 1 deletions

View File

@ -14,7 +14,10 @@ export const state = () => ({
export const mutations = {
initPlayer(state) {
if (process.client) {
state.loop = JSON.parse(localStorage.getItem("loop")) === true; // defaults to false
state.loop =
localStorage.getItem("loop") !== "undefined"
? JSON.parse(localStorage.getItem("loop"))
: true; // defaults to false
state.speed = JSON.parse(localStorage.getItem("speed")) || 1; // defaults to 1
state.speedAutosave = !(
// false if false, defaults to true