mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
fixed a bit
This commit is contained in:
1 parent
494f42a4c3
commit
26869d790e
2 files changed
+77
-55
No files matched your search
@@ -23,6 +23,13 @@ export default function Register() {
|
||||
body: JSON.stringify({ username, password }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const result = await response.json();
|
||||
setError(result.error || "Failed to register");
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.error) {
|
||||
@@ -44,7 +51,11 @@ export default function Register() {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
setError("An unexpected error occurred");
|
||||
if (err instanceof SyntaxError) {
|
||||
setError("Unexpected response from server");
|
||||
} else {
|
||||
setError("An unexpected error occurred");
|
||||
}
|
||||
console.error(err);
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user