mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 00:49:45 +01:00
plugin:yaak-models|upsert PoC
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import type { Environment } from '@yaakapp-internal/models';
|
||||
import { useSetAtom } from 'jotai/index';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { environmentsAtom, getEnvironment } from './useEnvironments';
|
||||
import { getEnvironment } from './useEnvironments';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
import { updateModelList } from './useSyncModelStores';
|
||||
|
||||
export function useUpdateEnvironment(id: string | null) {
|
||||
const setEnvironments = useSetAtom(environmentsAtom);
|
||||
return useFastMutation<
|
||||
Environment,
|
||||
unknown,
|
||||
@@ -22,8 +19,5 @@ export function useUpdateEnvironment(id: string | null) {
|
||||
const newEnvironment = typeof v === 'function' ? v(environment) : { ...environment, ...v };
|
||||
return invokeCmd<Environment>('cmd_update_environment', { environment: newEnvironment });
|
||||
},
|
||||
onSuccess: async (environment) => {
|
||||
setEnvironments(updateModelList(environment));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user