fix: show error message if Retry-After header is present in response

This commit is contained in:
Maël Gangloff
2024-08-06 17:29:29 +02:00
parent da1ae4cb8e
commit 7f30d446fa
3 changed files with 33 additions and 14 deletions

View File

@@ -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 {