mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 15:03:52 +00:00
try catch
This commit is contained in:
@@ -46,13 +46,18 @@ export default function UsernameForm({
|
||||
async function submitLoginName(values: Inputs, organization?: string) {
|
||||
setLoading(true);
|
||||
|
||||
const res = await sendLoginname({
|
||||
let res;
|
||||
try {
|
||||
res = await sendLoginname({
|
||||
loginName: values.loginName,
|
||||
organization,
|
||||
authRequestId,
|
||||
}).catch((error: Error) => {
|
||||
setError(error.message ?? "An internal error occurred");
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
setError(error.message ?? "An internal error occurred");
|
||||
}
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user