mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-24 15:38:18 +02:00
feat: Implement new dashboard, publicity management, and calendar pages with corresponding server routes.
This commit is contained in:
1 parent
eb3fb119ee
commit
78b53f576b
10 files changed
+696
-630
No files matched your search
@@ -39,15 +39,15 @@ export default function Publicities() {
|
||||
const startYear = currentYear - 2;
|
||||
const yearOptions = Array.from({ length: 13 }, (_, i) => startYear + i);
|
||||
|
||||
const { data: publicities = [], isLoading } = useQuery({
|
||||
queryKey: ['/api/publicities', selectedYear, selectedStoreId],
|
||||
const { data: publicities = [], isLoading } = useQuery<PublicityWithRelations[]>({
|
||||
queryKey: ['/api/ad-campaigns', selectedYear, selectedStoreId],
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams();
|
||||
params.append('year', selectedYear.toString());
|
||||
if (selectedStoreId) {
|
||||
params.append('storeId', selectedStoreId.toString());
|
||||
}
|
||||
const response = await fetch(`/api/publicities?${params}`);
|
||||
const response = await fetch(`/api/ad-campaigns?${params}`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch publicities');
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export default function Publicities() {
|
||||
console.log(`🗑️ [Frontend] Attempting to delete publicity ${id} using POST method`);
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/publicities/${id}/delete`, {
|
||||
const response = await fetch(`/api/ad-campaigns/${id}/delete`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({})
|
||||
@@ -111,7 +111,7 @@ export default function Publicities() {
|
||||
} else if (response.status === 404) {
|
||||
// Route not found, try DELETE method as fallback (for dev environment)
|
||||
console.log(`⚠️ [Frontend] POST route not found, trying DELETE method`);
|
||||
const deleteResponse = await fetch(`/api/publicities/${id}`, { method: 'DELETE' });
|
||||
const deleteResponse = await fetch(`/api/ad-campaigns/${id}`, { method: 'DELETE' });
|
||||
|
||||
if (!deleteResponse.ok) {
|
||||
const error = await deleteResponse.json();
|
||||
@@ -133,7 +133,7 @@ export default function Publicities() {
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/publicities'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/ad-campaigns'] });
|
||||
toast({ description: "Publicité supprimée avec succès" });
|
||||
setIsDeleteModalOpen(false);
|
||||
setSelectedPublicity(null);
|
||||
|
||||
Reference in new issue
Block a user