feature implement login part2
This commit is contained in:
@@ -30,14 +30,12 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
const login = async (credentials) => {
|
||||
await apiStore.postLogin(credentials)
|
||||
const response = await apiStore.getAuthUser()
|
||||
const jwtToken = response
|
||||
const user = response.data
|
||||
|
||||
setToken(jwtToken)
|
||||
currentUser.value = response.data
|
||||
return response.data
|
||||
const loginResp = await apiStore.postLogin(credentials)
|
||||
const userResp = await apiStore.getAuthUser()
|
||||
const jwtToken = loginResp.data.token
|
||||
setToken(jwtToken)
|
||||
currentUser.value = userResp.data
|
||||
return userResp.data
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
|
||||
Reference in New Issue
Block a user