conditional update download csv for staging & prod
This commit is contained in:
@ -56,3 +56,6 @@ export function deepMerge(obj1: any, obj2: any): any {
|
|||||||
export function uniqueID(): string {
|
export function uniqueID(): string {
|
||||||
return (Date.now() + Math.floor(Math.random() * 1000)).toString();
|
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`;
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import { Check, ChevronDown, X } from 'lucide-react';
|
|||||||
import { initialStateNotification, selectedNotification, validateFormNotification } from './Types';
|
import { initialStateNotification, selectedNotification, validateFormNotification } from './Types';
|
||||||
import { useDebounce } from './useDebounce';
|
import { useDebounce } from './useDebounce';
|
||||||
import Papa from 'papaparse';
|
import Papa from 'papaparse';
|
||||||
|
import { TEMPLATE_CSV_URL } from '@/lib/helpers';
|
||||||
|
|
||||||
const API_URL_CUSTOMER = apiConfig.service_customer;
|
const API_URL_CUSTOMER = apiConfig.service_customer;
|
||||||
const API_URL_NOTIFICATION = apiConfig.service_notification;
|
const API_URL_NOTIFICATION = apiConfig.service_notification;
|
||||||
@ -481,7 +482,7 @@ const AddDialog = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href="/dashboard/template_notification.csv"
|
href={TEMPLATE_CSV_URL}
|
||||||
download
|
download
|
||||||
className="px-3 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700"
|
className="px-3 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -2,13 +2,22 @@ import { fileURLToPath, URL } from 'node:url';
|
|||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import tailwindcss from 'tailwindcss';
|
import tailwindcss from 'tailwindcss';
|
||||||
|
|
||||||
export default ({ mode }) => {
|
export default ({ mode }) => {
|
||||||
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
|
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
base: process.env.VITE_BASE_URL || '/',
|
base: env.VITE_BASE_URL || '/',
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
css: { postcss: { plugins: [tailwindcss()] } },
|
css: { postcss: { plugins: [tailwindcss()] } },
|
||||||
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
define: {
|
||||||
|
'import.meta.env.VITE_BASE_URL': JSON.stringify(env.VITE_BASE_URL)
|
||||||
|
},
|
||||||
build: { chunkSizeWarningLimit: 3000 }
|
build: { chunkSizeWarningLimit: 3000 }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user