kmod-cli 1.4.13 → 1.4.15
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.
package/bin/index.js
CHANGED
|
@@ -74,7 +74,7 @@ async function copyComponent(name, collectedDeps) {
|
|
|
74
74
|
const dest = path.join(destBase, relPath);
|
|
75
75
|
|
|
76
76
|
await fs.copy(src, dest, { overwrite: false });
|
|
77
|
-
console.log(`✅
|
|
77
|
+
console.log(`✅ Installed: src/custom/${relPath}`);
|
|
78
78
|
|
|
79
79
|
// Collect deps
|
|
80
80
|
const userPkg = getUserPackageJson();
|
|
@@ -91,7 +91,7 @@ export interface DeleteManyParams {
|
|
|
91
91
|
meta?: AxiosRequestConfig;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
export interface CustomParams {
|
|
94
|
+
export interface CustomParams extends AxiosRequestConfig {
|
|
95
95
|
url?: string;
|
|
96
96
|
method?: 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
97
97
|
payload?: any;
|
|
@@ -221,8 +221,7 @@ class DataProvider {
|
|
|
221
221
|
options: DataProviderOptions = {}
|
|
222
222
|
) {
|
|
223
223
|
this.httpClient = httpClient;
|
|
224
|
-
|
|
225
|
-
// Lấy baseURL từ httpClient
|
|
224
|
+
|
|
226
225
|
const baseURL = httpClient.defaults.baseURL || '';
|
|
227
226
|
this.apiUrl = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
|
|
228
227
|
|
|
@@ -804,7 +803,8 @@ export function useOne<T = any>(
|
|
|
804
803
|
|
|
805
804
|
export function useCreate<T = any, V = any>(
|
|
806
805
|
resource: string,
|
|
807
|
-
options: UseMutationOptions<T
|
|
806
|
+
options: UseMutationOptions<T>,
|
|
807
|
+
meta?:AxiosRequestConfig
|
|
808
808
|
) {
|
|
809
809
|
const [loading, setLoading] = useState<boolean>(false);
|
|
810
810
|
const [error, setError] = useState<DataProviderError | null>(null);
|
|
@@ -819,7 +819,8 @@ export function useCreate<T = any, V = any>(
|
|
|
819
819
|
|
|
820
820
|
try {
|
|
821
821
|
const result = await dataProvider.create<T, V>(resource, {
|
|
822
|
-
variables
|
|
822
|
+
variables,
|
|
823
|
+
meta,
|
|
823
824
|
});
|
|
824
825
|
if (onSuccess) {
|
|
825
826
|
onSuccess(result.data);
|
|
@@ -842,7 +843,8 @@ export function useCreate<T = any, V = any>(
|
|
|
842
843
|
|
|
843
844
|
export function useUpdate<T = any, V = any>(
|
|
844
845
|
resource: string,
|
|
845
|
-
options: UseMutationOptions<T
|
|
846
|
+
options: UseMutationOptions<T>,
|
|
847
|
+
meta?: AxiosRequestConfig
|
|
846
848
|
) {
|
|
847
849
|
const [loading, setLoading] = useState<boolean>(false);
|
|
848
850
|
const [error, setError] = useState<DataProviderError | null>(null);
|
|
@@ -857,7 +859,7 @@ export function useUpdate<T = any, V = any>(
|
|
|
857
859
|
setError(null);
|
|
858
860
|
|
|
859
861
|
try {
|
|
860
|
-
const result = await dataProvider.update<T, V>(resource, { id, variables });
|
|
862
|
+
const result = await dataProvider.update<T, V>(resource, { id, variables, meta });
|
|
861
863
|
if (onSuccess) {
|
|
862
864
|
onSuccess(result.data);
|
|
863
865
|
}
|
|
@@ -881,7 +883,8 @@ export function useUpdate<T = any, V = any>(
|
|
|
881
883
|
|
|
882
884
|
export function useDelete<T = any>(
|
|
883
885
|
resource: string,
|
|
884
|
-
options: UseMutationOptions<T
|
|
886
|
+
options: UseMutationOptions<T>,
|
|
887
|
+
meta?: AxiosRequestConfig
|
|
885
888
|
) {
|
|
886
889
|
const [loading, setLoading] = useState<boolean>(false);
|
|
887
890
|
const [error, setError] = useState<DataProviderError | null>(null);
|
|
@@ -896,7 +899,7 @@ export function useDelete<T = any>(
|
|
|
896
899
|
setError(null);
|
|
897
900
|
|
|
898
901
|
try {
|
|
899
|
-
const result = await dataProvider.deleteOne<T>(resource, { id });
|
|
902
|
+
const result = await dataProvider.deleteOne<T>(resource, { id, meta });
|
|
900
903
|
if (onSuccess) {
|
|
901
904
|
onSuccess(result.data);
|
|
902
905
|
}
|
|
@@ -920,7 +923,7 @@ export function useDelete<T = any>(
|
|
|
920
923
|
|
|
921
924
|
export function useCustom<T = any>(
|
|
922
925
|
resource: string,
|
|
923
|
-
options: UseMutationOptions<T> & CustomParams
|
|
926
|
+
options: UseMutationOptions<T> & CustomParams,
|
|
924
927
|
) {
|
|
925
928
|
const [loading, setLoading] = useState<boolean>(false);
|
|
926
929
|
const [error, setError] = useState<DataProviderError | null>(null);
|
|
@@ -942,6 +945,7 @@ export function useCustom<T = any>(
|
|
|
942
945
|
method: options.method,
|
|
943
946
|
headers: options.headers,
|
|
944
947
|
query: options.query,
|
|
948
|
+
...options
|
|
945
949
|
});
|
|
946
950
|
if (onSuccess) {
|
|
947
951
|
onSuccess(result.data);
|