I save what I get from my backend to a local storage:+(我将从后端获得的内容保存到本地存储中:+)
async onSubmit(e){
e.preventDefault();
const {login, password } = this.state;
const response = await api.post('/login', { login,password });
const user = response.data.user;
const {jwt} = response.data;
console.log(user);
localStorage.setItem('token', jwt);
localStorage.setItem('user', user);
this.props.history.push("/home");
}
my(我的)
const user = response.data.user;(const用户= response.data.user;)
return this:(返回此:)
{id: 2, name: "spt", email: "email", login: "spt", password: "$2a$10$Rqc1VU1TfKD6MypNzbgemeR0O4YeXIFy1XiURjNeHk0gpWJitp4da", …}
two object [object object](两个对象[object object])
ask by Felipe translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…