refactor: centralize validation, error handling, and formatting logic
Extract shared auth logic and validation rules to shared/auth.ts Introduce utility functions for HTTP errors and user input parsing Standardize error messages and date formatting across the app
This commit is contained in:
@@ -305,6 +305,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getErrorMessage } from '../utils/errors'
|
||||
|
||||
interface SystemMenuItem {
|
||||
label: string
|
||||
to: string
|
||||
@@ -405,7 +407,7 @@ async function logout() {
|
||||
} catch (error: any) {
|
||||
toast.add({
|
||||
title: 'Logout failed',
|
||||
description: error?.data?.statusMessage || 'Unable to end the current session.',
|
||||
description: getErrorMessage(error, 'Unable to end the current session.'),
|
||||
color: 'error',
|
||||
icon: 'i-lucide-circle-alert'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user