add Pinia axios and VITE config to frontend.

This commit is contained in:
2026-09-28 14:55:56 +02:00
parent a7dac01168
commit ceeaea2120
7 changed files with 501 additions and 5 deletions
@@ -0,0 +1,23 @@
import axios from 'axios';
export function resolveAxiosErrorMessage(error: unknown, fallback = 'Request failed'): string {
if (axios.isAxiosError(error)) {
const data = error.response?.data;
if (typeof data === 'object' && data !== null && 'message' in data) {
const message = (data as { message: unknown }).message;
if (typeof message === 'string') {
return message;
}
if (Array.isArray(message)) {
return message.map(String).join(', ');
}
}
if (error.message) {
return error.message;
}
}
if (error instanceof Error) {
return error.message;
}
return fallback;
}