conditional update download csv for staging & prod

This commit is contained in:
rajaoktf
2025-10-14 16:32:00 +07:00
parent 63186911f5
commit 90d06a8b66
3 changed files with 17 additions and 4 deletions

View File

@ -56,3 +56,6 @@ export function deepMerge(obj1: any, obj2: any): any {
export function uniqueID(): string {
return (Date.now() + Math.floor(Math.random() * 1000)).toString();
}
const baseUrl = import.meta.env?.VITE_BASE_URL || '/';
export const TEMPLATE_CSV_URL = `${baseUrl}template_notification.csv`;

View File

@ -30,6 +30,7 @@ import { Check, ChevronDown, X } from 'lucide-react';
import { initialStateNotification, selectedNotification, validateFormNotification } from './Types';
import { useDebounce } from './useDebounce';
import Papa from 'papaparse';
import { TEMPLATE_CSV_URL } from '@/lib/helpers';
const API_URL_CUSTOMER = apiConfig.service_customer;
const API_URL_NOTIFICATION = apiConfig.service_notification;
@ -481,7 +482,7 @@ const AddDialog = () => {
/>
<a
href="/dashboard/template_notification.csv"
href={TEMPLATE_CSV_URL}
download
className="px-3 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700"
>