chore: update
This commit is contained in:
@@ -562,7 +562,6 @@ export const deleteProductMediaAdmin = async (
|
||||
return { success: true, message: data.message };
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// ============================================
|
||||
// ADDRESSES
|
||||
// ============================================
|
||||
@@ -711,31 +710,48 @@ export interface AppSettings {
|
||||
points_enabled: boolean;
|
||||
points_categories_weed: string[];
|
||||
points_categories_zipette: string[];
|
||||
points_categories_total: string[];
|
||||
points_separated: boolean;
|
||||
points_weed_tiers: PointsTier[];
|
||||
points_zipette_tiers: PointsTier[];
|
||||
points_total_tiers: PointsTier[];
|
||||
referral_enabled: boolean;
|
||||
}
|
||||
|
||||
export const getSettings = async (): Promise<{ success: boolean; settings?: AppSettings; error?: string }> => {
|
||||
export const getSettings = async (): Promise<{
|
||||
success: boolean;
|
||||
settings?: AppSettings;
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V2}/admin/protected/settings`);
|
||||
return { success: true, settings: data.settings };
|
||||
} catch (error: any) {
|
||||
return { success: false, error: error.response?.data?.error || "Erreur" };
|
||||
return {
|
||||
success: false,
|
||||
error: error.response?.data?.error || "Erreur",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const registerAdminPushToken = async (pushToken: string): Promise<void> => {
|
||||
export const registerAdminPushToken = async (
|
||||
pushToken: string,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
await apiClient.post(`${V2}/admin/protected/push-token`, { push_token: pushToken });
|
||||
} catch { /* ignore */ }
|
||||
await apiClient.post(`${V2}/admin/protected/push-token`, {
|
||||
push_token: pushToken,
|
||||
});
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
export const unregisterAdminPushToken = async (): Promise<void> => {
|
||||
try {
|
||||
await apiClient.delete(`${V2}/admin/protected/push-token`);
|
||||
} catch { /* ignore */ }
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
export interface AppNotification {
|
||||
@@ -746,7 +762,10 @@ export interface AppNotification {
|
||||
read: boolean;
|
||||
}
|
||||
|
||||
export const getAdminNotifications = async (): Promise<{ notifications: AppNotification[]; unread_count: number }> => {
|
||||
export const getAdminNotifications = async (): Promise<{
|
||||
notifications: AppNotification[];
|
||||
unread_count: number;
|
||||
}> => {
|
||||
const { data } = await apiClient.get(`${V2}/admin/protected/notifications`);
|
||||
return data;
|
||||
};
|
||||
@@ -759,9 +778,15 @@ export const updateSettings = async (
|
||||
settings: AppSettings,
|
||||
): Promise<{ success: boolean; settings?: AppSettings; error?: string }> => {
|
||||
try {
|
||||
const { data } = await apiClient.put(`${V2}/admin/protected/settings`, settings);
|
||||
const { data } = await apiClient.put(
|
||||
`${V2}/admin/protected/settings`,
|
||||
settings,
|
||||
);
|
||||
return { success: true, settings: data.settings };
|
||||
} catch (error: any) {
|
||||
return { success: false, error: error.response?.data?.error || "Erreur" };
|
||||
return {
|
||||
success: false,
|
||||
error: error.response?.data?.error || "Erreur",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user