Hi everbody,
recently I am starting with React and Blockstack and there are a lot of wonderful ressources like Techrally and the team around banter and lettermesh.
At the moment I face problem with setting a Global-State for the UserData. This global state is provided by a React Context.
Currently I construct the UserSession, but for example the methods isUserSignedIn() or loadUserData() dont work as expected on the Session attribute of the state.
Especially the function for the useReducer hook is not working:
const makeUserSession = (state) => {
const session = state.userSession
const auth = session.isUserSignedIn();
const data = session.loadUserData();
// console.log(data)
switch (auth) {
case true:
const data = session.loadUserData();
const name = data.username;
return {...state, userData: data, userName: name, userAuth: auth};
case false:
return {...state, userAuth: auth}
default:
return {...state, userAuth: auth}
}
}
If there is someone who has few spare minutes, it would be great if you look at the github repository --> Lexar and share your thoughts.
I am using next.js at the moment. Thanks