I have a problem with getting the variable from the wix-storage session. It always returns null, when I try to get the variable from session.getkey(…).
I store a value in a variable after clicking on a button on the one site:
import {session} from ‘wix-storage’ ;
$w.onReady( function () {
});
export function button18_click(event) {
// Add your code for this event here:
session.setItem( “wunscheinrichtung” , $w( ‘#text171’ ).text);
console.log(session.getItem( “wunscheinrichtung” ));
}
This part works. The system always prints the correct value in the console!
On the next site I want to call the variable:
import wixData from ‘wix-data’ ;
import { notifyOwnerOnDashboard } from ‘backend/notify’ ;
import wixWindow from ‘wix-window’ ;
import {session} from ‘wix-storage’ ;
var wunscheinrichtung;
$w.onReady(() => {
//set Datepicker to +1 day
$w( ‘#datePickerDat’ ).minDate = addDays(+ 1 );
$w( ‘#datePickerDat’ ).value = addDays(+ 1 );
wunscheinrichtung = session.getItem(" wunscheinrichtung" );
console.log(wunscheinrichtung);
});
The console always prints out ‘null’. Do I have to use async/await within the function?
Thank your very much for your help!