diff --git a/core/app/[locale]/(default)/account/(tabs)/_components/utils.ts b/core/app/[locale]/(default)/account/(tabs)/_components/utils.ts new file mode 100644 index 0000000000..1c57f32162 --- /dev/null +++ b/core/app/[locale]/(default)/account/(tabs)/_components/utils.ts @@ -0,0 +1,15 @@ +interface GenericError { + [p: string]: string | string[]; + message: string; +} + +export const createErrorsList = (submitErrors: GenericError[]) => + submitErrors + .map((error) => { + if (submitErrors.length > 1) { + return `\u2022 ${error.message}`; + } + + return error.message; + }) + .join('\n');