Patrick Arminio
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
7 additions and
1 deletions
-
frontend/src/hooks/useAuth.ts
|
@ -2,6 +2,7 @@ import { useMutation, useQuery } from "@tanstack/react-query" |
|
|
import { useNavigate } from "@tanstack/react-router" |
|
|
import { useNavigate } from "@tanstack/react-router" |
|
|
import { useState } from "react" |
|
|
import { useState } from "react" |
|
|
|
|
|
|
|
|
|
|
|
import { AxiosError } from "axios" |
|
|
import { |
|
|
import { |
|
|
type Body_login_login_access_token as AccessToken, |
|
|
type Body_login_login_access_token as AccessToken, |
|
|
type ApiError, |
|
|
type ApiError, |
|
@ -36,7 +37,12 @@ const useAuth = () => { |
|
|
navigate({ to: "/" }) |
|
|
navigate({ to: "/" }) |
|
|
}, |
|
|
}, |
|
|
onError: (err: ApiError) => { |
|
|
onError: (err: ApiError) => { |
|
|
const errDetail = (err.body as any)?.detail |
|
|
let errDetail = (err.body as any)?.detail |
|
|
|
|
|
|
|
|
|
|
|
if (err instanceof AxiosError) { |
|
|
|
|
|
errDetail = err.message |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
setError(errDetail) |
|
|
setError(errDetail) |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|