mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
chore: merge master
This commit is contained in:
@@ -48,7 +48,8 @@ export default function App() {
|
||||
if (location.pathname === '/login') navigate('/home')
|
||||
}).catch(() => {
|
||||
setIsAuthenticated(false)
|
||||
if (location.pathname !== '/login') navigate('/home')
|
||||
const pathname = location.pathname
|
||||
if (!['/login', '/tos', '/faq', '/privacy'].includes(pathname)) navigate('/home')
|
||||
})
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -19,6 +19,13 @@ export function RegisterForm() {
|
||||
register(data.username, data.password).then(() => {
|
||||
navigate('/home')
|
||||
}).catch((e) => {
|
||||
|
||||
if (e.response?.status === 429) {
|
||||
const duration = e.response.headers['retry-after']
|
||||
setError(t`Please retry after ${duration} seconds`)
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.response.data.message !== undefined) {
|
||||
setError(e.response.data.message)
|
||||
} else {
|
||||
|
||||
@@ -19,9 +19,15 @@ export default function DomainSearchPage() {
|
||||
setDomain(d)
|
||||
messageApi.success(t`Found !`)
|
||||
}).catch((e: AxiosError) => {
|
||||
const data = e?.response?.data as { detail: string }
|
||||
setDomain(undefined)
|
||||
messageApi.error(data.detail ?? t`An error occurred`)
|
||||
|
||||
if (e.response?.status === 429) {
|
||||
const duration = e.response.headers['retry-after']
|
||||
messageApi.error(t`Please retry after ${duration} seconds`)
|
||||
return;
|
||||
}
|
||||
const data = e?.response?.data as { detail: string }
|
||||
messageApi.error(data.detail !== '' ? data.detail : t`An error occurred`)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user