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 {
|
} else {
|
||||||
const payload = await res.json().catch(() => null);
|
const resData = await res.json();
|
||||||
error = payload?.message ?? 'Registration failed';
|
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;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user