update frontend ui, i18n, filters, and deps
This commit is contained in:
13
frontend/composables/useApi.ts
Normal file
13
frontend/composables/useApi.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const useApi = () => {
|
||||
const config = useRuntimeConfig()
|
||||
const apiBase = config.public.apiBase
|
||||
|
||||
const getErrorMessage = (err: unknown, fallback: string) => {
|
||||
const anyErr = err as { data?: { erreur?: string }; message?: string }
|
||||
if (anyErr?.data?.erreur) return anyErr.data.erreur
|
||||
if (anyErr?.message) return anyErr.message
|
||||
return fallback
|
||||
}
|
||||
|
||||
return { apiBase, getErrorMessage }
|
||||
}
|
||||
Reference in New Issue
Block a user