Closed wu-jeffrey closed 3 years ago
The interdependent / linked sliders implementation with text box is pretty janky but I'm happy that it works.
Also, once the save btn is clicked, the user will be updated, we should cause the auth consumer to refetch the user, so
AuthContext
, or a reloadUser()
fcn that can be called from AuthContext.Consumers
e.g. the macroeditor or modali.e. here:
componentDidMount() {
const token = localStorage.getItem('token');
const settings = {
method: 'GET',
headers: {
'x-auth-token': localStorage.getItem('token'),
},
};
(async () => {
const response = await fetch(encodeURI("/api/auth/user"), settings);
const user = await response.json();
if (response.status !== 200) {
this.setState({
loading: false,
isAuth: false,
})
} else {
this.setState({
loading: false,
isAuth: true,
token: token,
user: user,
})
}
})();
}
Fixes #17
TASKS: