In the code below I’m setting the current week in local storage using a page called Admin. I’m trying to access the variable in a lightbox on my homepage. When I console it out in desktop, it returns “Friday”, however in mobile, the same variable “week” returns “undefined”.
Admin Page:
import {local} from 'wix-storage';
export function setCurrentWeek_change(event) {
local.setItem("currentWeek", $w("#setCurrentWeek").value);
console.log("Current Week is: " + local.getItem("currentWeek")); //RETURNS "FRIDAY"
}
Lightbox on Homepage:
import { local} from 'wix-storage';
let week = local.getItem("currentWeek")
console.log("This is the current week: " + week) // RETURNS "FRIDAY" on desktop, "undefined" on mobile
I can’t understand how it works perfectly in desktop, but mobile the exact same code returns a different value.
If anyone has an idea of where to start to debug this, I’d appreciate it.