Sign up rate limit
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user