xbx #46

Merged
theluyuan merged 4 commits from xbx into master 2020-10-15 01:22:40 +00:00
3 changed files with 11 additions and 2 deletions
Showing only changes of commit c240c7aba3 - Show all commits

View File

@ -36,6 +36,12 @@ const del: Get = async function (url: string, data?: unknown){
return res.data; return res.data;
} }
const put: Get = async function (url: string, data?: unknown){
const res = await axios.put(url, {params:data})
return res.data;
}
function setToken(){ function setToken(){
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token"); axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
} }
@ -44,5 +50,6 @@ export {
get, get,
post, post,
del, del,
put,
setToken setToken
} }

View File

@ -37,7 +37,7 @@ export async function userinfo(){
const user = await get<UserInfo>('personalInfo'); const user = await get<UserInfo>('personalInfo');
// console.log(user.data.img) // console.log(user.data.img)
if(user.code == 1001){ if(user.code == 1001){
// router.push("/") router.push("/")
return '未登录'; return '未登录';
} }
return { return {

View File

@ -56,7 +56,9 @@ export default createStore({
actions: { actions: {
async setUserInfo({ commit }){ async setUserInfo({ commit }){
const user = await userinfo(); const user = await userinfo();
commit('setUserInfo', user); if(user != '未登录'){
commit('setUserInfo', user);
}
} }
}, },
modules: { modules: {