File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ export const AuthApi = {
66} > ( '/login/access-token' , credentials , {
77 headers : {
88 'Content-Type' : 'application/x-www-form-urlencoded'
9- } ,
10- requestOptions : {
11- rawResponse : true ,
129 }
1310 } ) ,
1411 logout : ( ) => request . post ( '/auth/logout' )
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ export const useUserStore = defineStore('user', () => {
99
1010 const login = async ( formData : { username : string ; password : string } ) => {
1111 username . value = formData . username
12- const res = await AuthApi . login ( formData )
13- token . value = res . data . access_token
12+ const res : any = await AuthApi . login ( formData )
13+ token . value = res . access_token
1414 wsCache . set ( 'user.token' , token . value )
1515 username . value = formData . username
1616 }
Original file line number Diff line number Diff line change @@ -94,6 +94,11 @@ class HttpService {
9494 /* if (response.data?.success !== true) {
9595 return Promise.reject(response.data)
9696 } */
97+ if ( response . data ?. code === 0 ) {
98+ return response . data . data
99+ } else if ( response . data ?. code ) {
100+ return Promise . reject ( response . data )
101+ }
97102 return response . data
98103 } ,
99104 async ( error : AxiosError ) => {
You can’t perform that action at this time.
0 commit comments