Commit 72369864 authored by Marek Veselý's avatar Marek Veselý
Browse files

feat: add loading to export button

parent 147ae56e
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -9,8 +9,10 @@ import ImportDialog from './ImportDialog'
const ExportImport = () => {
  const host = useHost()
  const [isImportOpen, setIsImportOpen] = useState(false)
  const [exportLoading, setExportLoading] = useState(false)

  const handleExport = () => {
    setExportLoading(true)
    authenticatedFetch(exportImportUrl(host || ''))
      .then(response => response.blob())
      .then(blob => {
@@ -21,6 +23,7 @@ const ExportImport = () => {
        a.click()
      })
      .catch(error => notify(error.message, { intent: 'danger' }))
      .finally(() => setExportLoading(false))
  }

  return (
@@ -34,7 +37,11 @@ const ExportImport = () => {
        }
        rightElement={
          <ButtonGroup>
            <Button icon='export' onClick={handleExport}>
            <Button
              icon='export'
              loading={exportLoading}
              onClick={handleExport}
            >
              Export
            </Button>
            <Button