Application screen goes blank and shows error (Type Error: Assignment to constant)
Application screen goes blank and shows error (Type Error: Assignment to constant)
有人知道为什么这在我的移动应用程序上显示空白屏幕但在网络上有效吗?
const [access_token, setAccessToken] = useState();
const [refresh_token, setRefreshToken] = useState();
if (access_token) {
localStorage.setItem('refresh_token', JSON.stringify(refresh_token));
localStorage.setItem('access_token', JSON.stringify(access_token));
// localStorage.setItem('expires_in', JSON.stringify(expires_in));
} else {
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
}
You should use setAccessToken and setRefreshToken for assignmentn not
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
setAccessToken(localStorage.getItem('access_token'))
setRefreshToken(localStorage.getItem('refresh_token'))
有人知道为什么这在我的移动应用程序上显示空白屏幕但在网络上有效吗?
const [access_token, setAccessToken] = useState();
const [refresh_token, setRefreshToken] = useState();
if (access_token) {
localStorage.setItem('refresh_token', JSON.stringify(refresh_token));
localStorage.setItem('access_token', JSON.stringify(access_token));
// localStorage.setItem('expires_in', JSON.stringify(expires_in));
} else {
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
}
You should use setAccessToken and setRefreshToken for assignmentn not
access_token = JSON.parse(localStorage.getItem('access_token'));
refresh_token = JSON.parse(localStorage.getItem('refresh_token'));
setAccessToken(localStorage.getItem('access_token'))
setRefreshToken(localStorage.getItem('refresh_token'))