mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: improve error handling for registration response
This commit is contained in:
@@ -95,8 +95,13 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const payload = await res.json().catch(() => null);
|
||||
error = payload?.message ?? 'Registration failed';
|
||||
const resData = await res.json();
|
||||
if (resData.errors) {
|
||||
const messages = Object.values(resData.errors).flat();
|
||||
error = messages.join('\n');
|
||||
} else {
|
||||
error = resData.message || 'Registration failed. Please try again.';
|
||||
}
|
||||
}
|
||||
loading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user