1
0
Fork 0
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:
binwiederhier 2022-12-24 12:10:51 -05:00
parent 7bd1c6e115
commit fb470eec79
7 changed files with 34 additions and 10 deletions
web/src/app

View file

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