@omniumretail/shared-resources 0.1.75 → 0.1.77
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/dist/bundle.js +1 -1
- package/dist/types/hooks/Asta/Answer/mutate/useAstaAnswersMutateQuery.hook.d.ts +1 -1
- package/package.json +1 -1
- package/src/hooks/Asta/Answer/mutate/useAstaAnswersMutateQuery.hook.ts +6 -3
- package/src/hooks/Asta/Inspection/mutate/useInspectionMutateQuery.hook.ts +7 -2
- package/src/hooks/Asta/Inspection/others/finishInspectionQuery.hook.ts +3 -1
- package/src/hooks/Asta/Template/get/getTemplateByIdQuery.hook.ts +3 -1
- package/src/hooks/Asta/Template/mutate/useTemplateMutateQuery.hook.ts +5 -2
- package/src/hooks/Asta/Template/others/finishTemplateQuery.hook.ts +3 -1
- package/src/interfaces/Template.ts +7 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Answer } from '../../../../interfaces';
|
|
2
|
-
export declare const useAstaAnswersMutateHook: (
|
|
2
|
+
export declare const useAstaAnswersMutateHook: (inspectionId: string) => import("@tanstack/react-query").UseMutationResult<Answer, unknown, Answer, unknown>;
|
package/package.json
CHANGED
|
@@ -2,12 +2,15 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
|
2
2
|
import { Answer } from '../../../../interfaces';
|
|
3
3
|
import { putAuth0, postAuth0 } from '../../../../services/ApiService';
|
|
4
4
|
|
|
5
|
-
export const useAstaAnswersMutateHook = (
|
|
5
|
+
export const useAstaAnswersMutateHook = (inspectionId: string) => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Answer, unknown, Answer>((data: Answer) => {
|
|
8
8
|
return data.Id ?
|
|
9
|
-
putAuth0(`/ASTA/Answers/${data.Id}`, undefined, data)
|
|
10
|
-
|
|
9
|
+
putAuth0(`/ASTA/Answers/${data.Id}`, undefined, data)
|
|
10
|
+
|
|
11
|
+
: postAuth0(`/ASTA/Answers`, {
|
|
12
|
+
pInspectionId: inspectionId
|
|
13
|
+
}, data);
|
|
11
14
|
}, {
|
|
12
15
|
onSuccess: (data: Answer) => {
|
|
13
16
|
queryClient.setQueryData(
|
|
@@ -6,8 +6,13 @@ export const useInspectionMutateHook = (templateId: string) => {
|
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Inspection, unknown, Inspection>((data: Inspection) => {
|
|
8
8
|
return data.Id ?
|
|
9
|
-
putAuth0(`/ASTA/Inspection/FileInspection
|
|
10
|
-
|
|
9
|
+
putAuth0(`/ASTA/Inspection/FileInspection}`, {
|
|
10
|
+
pId: data.Id
|
|
11
|
+
}, data) :
|
|
12
|
+
|
|
13
|
+
postAuth0(`/ASTA/Inspection`, {
|
|
14
|
+
pId: templateId
|
|
15
|
+
} , data);
|
|
11
16
|
}, {
|
|
12
17
|
onSuccess: (data: Inspection) => {
|
|
13
18
|
queryClient.setQueryData(
|
|
@@ -5,7 +5,9 @@ import { putAuth0 } from '../../../../services/ApiService';
|
|
|
5
5
|
export const finishInspectionQueryHook = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Inspection, unknown, Inspection>((data: Inspection) => {
|
|
8
|
-
return putAuth0(`/ASTA/Inspection/FinishInspection
|
|
8
|
+
return putAuth0(`/ASTA/Inspection/FinishInspection`, {
|
|
9
|
+
pId: data.Id
|
|
10
|
+
}, data)
|
|
9
11
|
}, {
|
|
10
12
|
onSuccess: (data: Inspection) => {
|
|
11
13
|
queryClient.setQueryData(
|
|
@@ -5,7 +5,9 @@ import { getAuth0 } from "../../../../services/ApiService";
|
|
|
5
5
|
export const getTemplateByIdQueryHook = (templateId: string) => {
|
|
6
6
|
return useQuery(
|
|
7
7
|
['TEMPLATE_ID_QUERY', templateId],
|
|
8
|
-
() => getAuth0<Template>(`/ASTA/Template/GetById
|
|
8
|
+
() => getAuth0<Template>(`/ASTA/Template/GetById`, {
|
|
9
|
+
pId: templateId
|
|
10
|
+
}),
|
|
9
11
|
{
|
|
10
12
|
enabled: !!(templateId),
|
|
11
13
|
},
|
|
@@ -6,8 +6,11 @@ export const useTemplateMutateHook = () => {
|
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
8
8
|
return data.Id ?
|
|
9
|
-
putAuth0(`/ASTA/Template/FileTemplate
|
|
10
|
-
|
|
9
|
+
putAuth0(`/ASTA/Template/FileTemplate`, {
|
|
10
|
+
pId: data.Id
|
|
11
|
+
}, data)
|
|
12
|
+
|
|
13
|
+
: postAuth0('/ASTA/Template', undefined, data);
|
|
11
14
|
}, {
|
|
12
15
|
onSuccess: (data: Template) => {
|
|
13
16
|
queryClient.setQueryData(
|
|
@@ -5,7 +5,9 @@ import { putAuth0 } from '../../../../services/ApiService';
|
|
|
5
5
|
export const finishTemplateQueryHook = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
8
|
-
return putAuth0(`/ASTA/Template/FinishTemplate
|
|
8
|
+
return putAuth0(`/ASTA/Template/FinishTemplate`, {
|
|
9
|
+
pId: data.Id
|
|
10
|
+
}, data);
|
|
9
11
|
}, {
|
|
10
12
|
onSuccess: (data: Template) => {
|
|
11
13
|
queryClient.setQueryData(
|
|
@@ -16,9 +16,13 @@ export interface Template {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface AstaCategories {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
Title: string;
|
|
20
|
+
Key: string;
|
|
21
|
+
Data: {
|
|
22
|
+
Name: string;
|
|
23
|
+
Questions: AstaQuestions[];
|
|
24
|
+
};
|
|
25
|
+
Children: AstaCategories[];
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export interface HeadersInterface {
|