mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 06:02:00 +02:00
Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
import { ExportDataDialog } from '../components/ExportDataDialog';
|
||||
import { showAlert } from '../lib/alert';
|
||||
import { showDialog } from '../lib/dialog';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { getActiveWorkspace } from './useActiveWorkspace';
|
||||
import { useAlert } from './useAlert';
|
||||
import { useDialog } from './useDialog';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import { showToast } from '../lib/toast';
|
||||
import { getActiveWorkspace } from './useActiveWorkspace';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import { workspacesAtom } from './useWorkspaces';
|
||||
|
||||
export function useExportData() {
|
||||
const alert = useAlert();
|
||||
const dialog = useDialog();
|
||||
|
||||
return useFastMutation({
|
||||
mutationKey: ['export_data'],
|
||||
onError: (err: string) => {
|
||||
alert({ id: 'export-failed', title: 'Export Failed', body: err });
|
||||
showAlert({ id: 'export-failed', title: 'Export Failed', body: err });
|
||||
},
|
||||
mutationFn: async () => {
|
||||
const activeWorkspace = getActiveWorkspace();
|
||||
@@ -22,7 +19,7 @@ export function useExportData() {
|
||||
|
||||
if (activeWorkspace == null || workspaces.length === 0) return;
|
||||
|
||||
dialog.show({
|
||||
showDialog({
|
||||
id: 'export-data',
|
||||
title: 'Export App Data',
|
||||
size: 'md',
|
||||
|
||||
Reference in New Issue
Block a user