before gemiin
This commit is contained in:
@@ -3,4 +3,19 @@ export const settingsApi = {
|
||||
get: () => client.get('/api/settings').then(r => r.data),
|
||||
update: (settings) => client.put('/api/settings', settings).then(r => r.data),
|
||||
getDebugSystemStats: () => client.get('/api/settings/debug/system').then(r => r.data),
|
||||
downloadBackup: () => client.get('/api/settings/backup/download', { responseType: 'blob' }).then(r => {
|
||||
let filename = 'jardin_backup.zip';
|
||||
const contentDisposition = r.headers?.['content-disposition'];
|
||||
if (typeof contentDisposition === 'string') {
|
||||
const utf8Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/i);
|
||||
const classicMatch = contentDisposition.match(/filename="?([^\";]+)"?/i);
|
||||
if (utf8Match?.[1]) {
|
||||
filename = decodeURIComponent(utf8Match[1]);
|
||||
}
|
||||
else if (classicMatch?.[1]) {
|
||||
filename = classicMatch[1];
|
||||
}
|
||||
}
|
||||
return { blob: r.data, filename };
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -30,4 +30,19 @@ export const settingsApi = {
|
||||
client.put<{ ok: boolean }>('/api/settings', settings).then(r => r.data),
|
||||
getDebugSystemStats: () =>
|
||||
client.get<DebugSystemStats>('/api/settings/debug/system').then(r => r.data),
|
||||
downloadBackup: () =>
|
||||
client.get('/api/settings/backup/download', { responseType: 'blob' }).then(r => {
|
||||
let filename = 'jardin_backup.zip'
|
||||
const contentDisposition = r.headers?.['content-disposition']
|
||||
if (typeof contentDisposition === 'string') {
|
||||
const utf8Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/i)
|
||||
const classicMatch = contentDisposition.match(/filename="?([^\";]+)"?/i)
|
||||
if (utf8Match?.[1]) {
|
||||
filename = decodeURIComponent(utf8Match[1])
|
||||
} else if (classicMatch?.[1]) {
|
||||
filename = classicMatch[1]
|
||||
}
|
||||
}
|
||||
return { blob: r.data as Blob, filename }
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ export interface Task {
|
||||
titre: string
|
||||
description?: string
|
||||
garden_id?: number
|
||||
planting_id?: number
|
||||
outil_id?: number
|
||||
priorite: string
|
||||
echeance?: string
|
||||
recurrence?: string | null
|
||||
@@ -14,7 +16,7 @@ export interface Task {
|
||||
}
|
||||
|
||||
export const tasksApi = {
|
||||
list: (params?: { statut?: string; garden_id?: number }) =>
|
||||
list: (params?: { statut?: string; garden_id?: number; planting_id?: number }) =>
|
||||
client.get<Task[]>('/api/tasks', { params }).then(r => r.data),
|
||||
get: (id: number) => client.get<Task>(`/api/tasks/${id}`).then(r => r.data),
|
||||
create: (t: Partial<Task>) => client.post<Task>('/api/tasks', t).then(r => r.data),
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface Tool {
|
||||
categorie?: string
|
||||
photo_url?: string
|
||||
video_url?: string
|
||||
notice_texte?: string
|
||||
notice_fichier_url?: string
|
||||
boutique_nom?: string
|
||||
boutique_url?: string
|
||||
|
||||
Reference in New Issue
Block a user