diff --git a/reminder-dashboard/src/components/Import/index.tsx b/reminder-dashboard/src/components/Import/index.tsx index fe4c53a..4406530 100644 --- a/reminder-dashboard/src/components/Import/index.tsx +++ b/reminder-dashboard/src/components/Import/index.tsx @@ -33,6 +33,7 @@ const ImportModal = ({ setModalOpen }) => { const aRef = useRef(); const inputRef = useRef(); + const selectRef = useRef(); const flash = useFlash(); const [isImporting, setIsImporting] = useState(false); @@ -55,17 +56,16 @@ const ImportModal = ({ setModalOpen }) => { > <>
-
- +
+

@@ -90,7 +90,9 @@ const ImportModal = ({ setModalOpen }) => { id="export-data" onClick={() => axios - .get(`/dashboard/api/guild/${guild}/export/reminders`) + .get( + `/dashboard/api/guild/${guild}/export/${selectRef.current.value}`, + ) .then(({ data, status }) => { if (status === 200) { aRef.current.href = `data:text/plain;charset=utf-8,${encodeURIComponent( @@ -124,11 +126,15 @@ const ImportModal = ({ setModalOpen }) => { setIsImporting(true); axios - .put(`/dashboard/api/guild/${guild}/export/reminders`, { - body: dataUrl.split(",")[1], - }) + .put( + `/dashboard/api/guild/${guild}/export/${selectRef.current.value}`, + { + body: dataUrl.split(",")[1], + }, + ) .then(({ data }) => { setIsImporting(false); + setModalOpen(false); if (data.error) { flash({ message: data.error, type: "error" }); @@ -137,6 +143,9 @@ const ImportModal = ({ setModalOpen }) => { queryClient.invalidateQueries({ queryKey: ["GUILD_REMINDERS", guild], }); + queryClient.invalidateQueries({ + queryKey: ["GUILD_TEMPLATES", guild], + }); } }) .then(() => {