Skip to content

Commit 5bee6cd

Browse files
committed
fix: add ErrorMessage component and integrate it into LoginView for improved error handling
1 parent 9461618 commit 5bee6cd

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div v-if="error" class="af-login-modal-error flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
3+
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
4+
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
5+
</svg>
6+
<span class="sr-only">{{ $t('Info') }}</span>
7+
<div>
8+
{{ error }}
9+
</div>
10+
</div>
11+
</template>
12+
13+
<script setup>
14+
15+
defineProps({
16+
error: {
17+
type: String,
18+
default: null
19+
}
20+
});
21+
</script>

adminforth/spa/src/views/LoginView.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,7 @@
9292
:meta="c.meta"
9393
/>
9494

95-
<div v-if="error" class="af-login-modal-error flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
96-
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
97-
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
98-
</svg>
99-
<span class="sr-only">{{ $t('Info') }}</span>
100-
<div>
101-
{{ error }}
102-
</div>
103-
</div>
95+
<ErrorMessage :error="error" />
10496

10597
<div v-if="loginPromptHTML"
10698
class="flex items-center p-4 mb-4 text-sm text-lightLoginViewPromptText rounded-lg bg-lightLoginViewPromptBackground dark:bg-darkLoginViewPromptBackground dark:text-darkLoginViewPromptText" role="alert"
@@ -136,6 +128,7 @@ import { callAdminForthApi, loadFile } from '@/utils';
136128
import { useRoute, useRouter } from 'vue-router';
137129
import { Button, Checkbox, Input } from '@/afcl';
138130
import { useI18n } from 'vue-i18n';
131+
import ErrorMessage from '@/components/ErrorMessage.vue';
139132
140133
const { t } = useI18n();
141134

0 commit comments

Comments
 (0)