We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a3cd9d commit b2157c9Copy full SHA for b2157c9
frontend/src/hooks/useAuth.ts
@@ -2,6 +2,7 @@ import { useMutation, useQuery } from "@tanstack/react-query"
2
import { useNavigate } from "@tanstack/react-router"
3
import { useState } from "react"
4
5
+import { AxiosError } from "axios"
6
import {
7
type Body_login_login_access_token as AccessToken,
8
type ApiError,
@@ -36,7 +37,12 @@ const useAuth = () => {
36
37
navigate({ to: "/" })
38
},
39
onError: (err: ApiError) => {
- const errDetail = (err.body as any)?.detail
40
+ let errDetail = (err.body as any)?.detail
41
+
42
+ if (err instanceof AxiosError) {
43
+ errDetail = err.message
44
+ }
45
46
setError(errDetail)
47
48
})
0 commit comments