Fix incorrect admin login error handling
Change-Id: I68c338b0cb7b261db6c9240cbc5c1e253290e753
diff --git a/client/src/utils/auth.ts b/client/src/utils/auth.ts
index 3704fe4..822771c 100644
--- a/client/src/utils/auth.ts
+++ b/client/src/utils/auth.ts
@@ -41,9 +41,7 @@
export async function isNameRegistered(name: string): Promise<boolean> {
try {
- await axios.get(`/ns/username/${name}`, {
- baseURL: apiUrl,
- });
+ await axios.get(`/ns/username/${name}`, { baseURL: apiUrl });
return true;
} catch (e: any) {
if (e.response?.status !== HttpStatusCode.NotFound) {
@@ -63,24 +61,12 @@
}
export async function registerUser(username: string, password: string): Promise<void> {
- await axios.post(
- '/auth/new-account',
- { username, password },
- {
- baseURL: apiUrl,
- }
- );
+ await axios.post('/auth/new-account', { username, password }, { baseURL: apiUrl });
}
export async function loginUser(username: string, password: string): Promise<string> {
try {
- const { data } = await axios.post(
- '/auth/login',
- { username, password },
- {
- baseURL: apiUrl,
- }
- );
+ const { data } = await axios.post('/auth/login', { username, password }, { baseURL: apiUrl });
return data.accessToken;
} catch (e: any) {
switch (e.response?.status) {