vue+axios登录时获取token和userId

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_39378691/article/details/83754112
1.登录成功后,存储后台返回的token值和userId

PS:把username和password,post请求发送到后台,若username和password正确,后台返回token和userId。若本地存储有token,localStorage.getItem(‘token’),则路由跳转到index页面,否则跳转到login;若username和password有其一错误,则登录不成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_39378691/article/details/83754112