Fix another localStorage bug
This commit is contained in:
parent
5d8375a9c8
commit
1398154b4b
5 changed files with 34 additions and 137 deletions
src/routes
1
src/routes/+layout.ts
Normal file
1
src/routes/+layout.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export const prerender = true;
|
|
@ -158,41 +158,33 @@
|
|||
if (navigator) {
|
||||
locale = navigator.language;
|
||||
}
|
||||
let localThrusters = localStorage.getItem("thrusters");
|
||||
if (typeof localThrusters !== "undefined" && localThrusters !== "" && localGravity != null) {
|
||||
thrusters = JSON.parse(localThrusters);
|
||||
|
||||
if (localStorage.getItem("thrusters") !== null) {
|
||||
thrusters = JSON.parse(localStorage.getItem("thrusters"))
|
||||
}
|
||||
|
||||
let localInventories = localStorage.getItem("inventories");
|
||||
if (typeof localInventories !== "undefined" && localInventories !== "" && localGravity != null) {
|
||||
inventories = JSON.parse(localInventories);
|
||||
if (localStorage.getItem("inventories") !== null) {
|
||||
inventories = JSON.parse(localStorage.getItem("inventories"))
|
||||
}
|
||||
|
||||
let localGridSize = localStorage.getItem("gridSize");
|
||||
if (typeof localGridSize !== "undefined" && localGridSize !== "" && localGravity != null) {
|
||||
gridSize = localGridSize;
|
||||
if (localStorage.getItem("gridSize") !== null) {
|
||||
gridSize = localStorage.getItem("gridSize")
|
||||
}
|
||||
|
||||
console.log(gravity);
|
||||
let localGravity = localStorage.getItem("gravity");
|
||||
if (typeof localGravity !== "undefined" && localGravity !== "" && localGravity != null) {
|
||||
console.log(localGravity);
|
||||
gravity = localGravity;
|
||||
if (localStorage.getItem("gravity") !== null) {
|
||||
gravity = localStorage.getItem("gravity")
|
||||
}
|
||||
|
||||
let localInventoryMultiplicator = localStorage.getItem("inventoryMultiplier");
|
||||
if (typeof localInventoryMultiplicator !== "undefined" && localInventoryMultiplicator !== "" && localGravity != null) {
|
||||
inventoryMultiplier = localInventoryMultiplicator;
|
||||
if (localStorage.getItem("inventoryMultiplier") !== null) {
|
||||
inventoryMultiplier = localStorage.getItem("inventoryMultiplier")
|
||||
}
|
||||
|
||||
let localNewThruster = localStorage.getItem("newThruster");
|
||||
if (typeof localNewThruster !== "undefined" && localNewThruster !== "" && localGravity != null) {
|
||||
newThruster = JSON.parse(localNewThruster);
|
||||
if (localStorage.getItem("newThruster") !== null) {
|
||||
newThruster = JSON.parse(localStorage.getItem("newThruster"))
|
||||
}
|
||||
|
||||
let localNewInventory = localStorage.getItem("newInventory");
|
||||
if (typeof localNewInventory !== "undefined" && localNewInventory !== "" && localGravity != null) {
|
||||
newInventory = JSON.parse(localNewInventory);
|
||||
if (localStorage.getItem("newInventory") !== null) {
|
||||
newInventory = JSON.parse(localStorage.getItem("newInventory"))
|
||||
}
|
||||
|
||||
mounted = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue