gomtm 0.0.362 → 0.0.364
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -53,6 +53,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
53
53
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
54
54
|
import { createContext, useCallback, useContext, useMemo, useRef } from "react";
|
|
55
55
|
import { useForm } from "react-hook-form";
|
|
56
|
+
import { toast } from "sonner";
|
|
56
57
|
import { useStore } from "zustand";
|
|
57
58
|
import { createStore } from "zustand/vanilla";
|
|
58
59
|
import { useGomtmMutation } from "../../gomtmQuery";
|
|
@@ -115,7 +116,37 @@ function useGomtmForm2() {
|
|
|
115
116
|
_setOpen(open);
|
|
116
117
|
}, [_setOpen]);
|
|
117
118
|
const handleValuesSubmit = useCallback((values) => __async(this, null, function* () {
|
|
118
|
-
|
|
119
|
+
try {
|
|
120
|
+
const result = yield mutation.mutateAsync(values);
|
|
121
|
+
console.log("result", result);
|
|
122
|
+
const a = result;
|
|
123
|
+
if (a.errCode) {
|
|
124
|
+
toast("Error:" + a.errCode, {
|
|
125
|
+
description: a.errMessage,
|
|
126
|
+
action: {
|
|
127
|
+
label: "Undo",
|
|
128
|
+
onClick: () => console.log("Undo")
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
toast("OK", {
|
|
133
|
+
// description: JSON.stringify(result, null, 2),
|
|
134
|
+
description: "ok",
|
|
135
|
+
action: {
|
|
136
|
+
label: "Undo",
|
|
137
|
+
onClick: () => console.log("Undo")
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
} catch (e) {
|
|
142
|
+
toast("Error", {
|
|
143
|
+
description: "Sunday, December 03, 2023 at 9:00 AM",
|
|
144
|
+
action: {
|
|
145
|
+
label: "Undo",
|
|
146
|
+
onClick: () => console.log("Undo")
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
119
150
|
setOpen(false);
|
|
120
151
|
}), [setOpen, mutation]);
|
|
121
152
|
const handleFormSubmit = useCallback(() => {
|
|
@@ -44,7 +44,8 @@ function useCurdRemove() {
|
|
|
44
44
|
const activateItem = useListview((x) => x.activateItem);
|
|
45
45
|
const queryClient = useQueryClient();
|
|
46
46
|
const handlerSubmit = useCallback(() => __async(this, null, function* () {
|
|
47
|
-
|
|
47
|
+
const aaa = mutation;
|
|
48
|
+
yield aaa.mutateAsync({
|
|
48
49
|
ids: [activateItem == null ? void 0 : activateItem.id.toString()]
|
|
49
50
|
});
|
|
50
51
|
}), [activateItem, mutation]);
|
package/dist/esm/gomtmQuery.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import { MtmError } from "./gomtmpb/mtm/sppb/mtm_pb";
|
|
|
4
4
|
export declare function useGomtmQuery<T = any>(svc: string, method: string, input?: any): import("@tanstack/react-query").UseQueryResult<T, Error>;
|
|
5
5
|
export declare function useGomtmSuspenseQuery<T = any>(svc: string, method: string, input?: any): import("@tanstack/react-query").UseSuspenseQueryResult<T, Error>;
|
|
6
6
|
export declare function useGomtmSuspenseInfiniteQuery<T = any>(svc: string, method: string, input?: any): import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<T & PlainMessage<MtmError>, unknown>, Error>;
|
|
7
|
-
export declare function useGomtmMutation<TData =
|
|
7
|
+
export declare function useGomtmMutation<TData = any, TError = DefaultError, TVariables = any, TContext = unknown>(svc: string, method: string, options?: UseMutationOptions): import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
|
package/dist/esm/gomtmQuery.js
CHANGED
|
@@ -70,9 +70,13 @@ function useGomtmSuspenseInfiniteQuery(svc, method, input) {
|
|
|
70
70
|
}
|
|
71
71
|
function useGomtmMutation(svc, method, options) {
|
|
72
72
|
const fn = useGmtmQjeryFn();
|
|
73
|
-
|
|
74
|
-
mutationFn: (input) =>
|
|
73
|
+
const a = useMutation(__spreadProps(__spreadValues({}, options), {
|
|
74
|
+
mutationFn: (input) => {
|
|
75
|
+
const b = fn(svc, method, input);
|
|
76
|
+
return b;
|
|
77
|
+
}
|
|
75
78
|
}));
|
|
79
|
+
return a;
|
|
76
80
|
}
|
|
77
81
|
export {
|
|
78
82
|
useGomtmMutation,
|