mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-17 18:13:21 +02:00
Sign up rate limit
This commit is contained in:
parent
7bd1c6e115
commit
fb470eec79
7 changed files with 34 additions and 10 deletions
web/src/app
|
@ -161,9 +161,10 @@ class Api {
|
|||
body: body
|
||||
});
|
||||
if (response.status === 409) {
|
||||
throw new UsernameTakenError(username)
|
||||
}
|
||||
if (response.status !== 200) {
|
||||
throw new UsernameTakenError(username);
|
||||
} else if (response.status === 429) {
|
||||
throw new AccountCreateLimitReachedError();
|
||||
} else if (response.status !== 200) {
|
||||
throw new Error(`Unexpected server response ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
@ -260,5 +261,9 @@ export class UsernameTakenError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
export class AccountCreateLimitReachedError extends Error {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
const api = new Api();
|
||||
export default api;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue