@axcode/axcloud-sdk 0.4.0-dev.bf5c2c0 → 0.4.0-dev.f5f8764
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/README.md +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -617,7 +617,7 @@ The SDK uses two types of credentials:
|
|
|
617
617
|
| Public content | API key (x-api-key header) | `/content/public/{orgId}/news` |
|
|
618
618
|
| Member content | JWT Bearer token | `/content/members/{orgId}/news` |
|
|
619
619
|
| User data | JWT Bearer token | `/api/users/me` |
|
|
620
|
-
| Admin | JWT Bearer token + role | `/
|
|
620
|
+
| Admin | JWT Bearer token + role | `/forms/admin/submissions` |
|
|
621
621
|
|
|
622
622
|
## Error Handling
|
|
623
623
|
|
package/dist/index.js
CHANGED
|
@@ -859,17 +859,18 @@ function useSections() {
|
|
|
859
859
|
refetch: query.refetch
|
|
860
860
|
};
|
|
861
861
|
}
|
|
862
|
+
var FORMS_ADMIN_PATH = "/forms/admin";
|
|
862
863
|
function useForms(options = {}) {
|
|
863
|
-
const { client,
|
|
864
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
864
865
|
const { formType, status, limit = 50, cursor } = options;
|
|
865
866
|
const query = reactQuery.useQuery({
|
|
866
|
-
queryKey: ["axcloud", "forms", "submissions",
|
|
867
|
+
queryKey: ["axcloud", "forms", "submissions", orgId, formType, status, limit, cursor],
|
|
867
868
|
queryFn: async () => {
|
|
868
|
-
const params = { limit };
|
|
869
|
+
const params = { org_id: orgId, limit };
|
|
869
870
|
if (formType) params.form_type = formType;
|
|
870
871
|
if (status) params.status = status;
|
|
871
872
|
if (cursor) params.cursor = cursor;
|
|
872
|
-
return client.get(
|
|
873
|
+
return client.get(`${FORMS_ADMIN_PATH}/submissions`, params);
|
|
873
874
|
},
|
|
874
875
|
staleTime: 1e3 * 30
|
|
875
876
|
// 30 seconds
|
|
@@ -886,12 +887,12 @@ function useForms(options = {}) {
|
|
|
886
887
|
};
|
|
887
888
|
}
|
|
888
889
|
function useFormStats(options = {}) {
|
|
889
|
-
const { client,
|
|
890
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
890
891
|
const { days = 30 } = options;
|
|
891
892
|
const query = reactQuery.useQuery({
|
|
892
|
-
queryKey: ["axcloud", "forms", "stats",
|
|
893
|
+
queryKey: ["axcloud", "forms", "stats", orgId, days],
|
|
893
894
|
queryFn: async () => {
|
|
894
|
-
return client.get(
|
|
895
|
+
return client.get(`${FORMS_ADMIN_PATH}/stats`, { org_id: orgId, days });
|
|
895
896
|
},
|
|
896
897
|
staleTime: 1e3 * 60 * 5
|
|
897
898
|
// 5 minutes
|
|
@@ -907,7 +908,7 @@ function useFormStats(options = {}) {
|
|
|
907
908
|
};
|
|
908
909
|
}
|
|
909
910
|
function useUpdateFormSubmission() {
|
|
910
|
-
const { client,
|
|
911
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
911
912
|
const queryClient = reactQuery.useQueryClient();
|
|
912
913
|
return reactQuery.useMutation({
|
|
913
914
|
mutationFn: async ({
|
|
@@ -915,7 +916,10 @@ function useUpdateFormSubmission() {
|
|
|
915
916
|
status,
|
|
916
917
|
notes
|
|
917
918
|
}) => {
|
|
918
|
-
return client.patch(
|
|
919
|
+
return client.patch(
|
|
920
|
+
`${FORMS_ADMIN_PATH}/submissions/${encodeURIComponent(submissionId)}?org_id=${encodeURIComponent(orgId)}`,
|
|
921
|
+
{ status, notes }
|
|
922
|
+
);
|
|
919
923
|
},
|
|
920
924
|
onSuccess: () => {
|
|
921
925
|
queryClient.invalidateQueries({ queryKey: ["axcloud", "forms"] });
|