@axcode/axcloud-sdk 0.1.2 → 0.1.4

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/index.d.mts CHANGED
@@ -900,12 +900,16 @@ declare function useMySection(options?: {
900
900
  * const { sections } = useSections()
901
901
  * ```
902
902
  */
903
+ interface SectionsResponse {
904
+ sections: Section[];
905
+ total: number;
906
+ }
903
907
  declare function useSections(): {
904
908
  sections: Section[];
905
909
  isLoading: boolean;
906
910
  isError: boolean;
907
911
  error: Error | null;
908
- refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Section[], Error>>;
912
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SectionsResponse, Error>>;
909
913
  };
910
914
 
911
915
  interface UseFormsOptions {
package/dist/index.d.ts CHANGED
@@ -900,12 +900,16 @@ declare function useMySection(options?: {
900
900
  * const { sections } = useSections()
901
901
  * ```
902
902
  */
903
+ interface SectionsResponse {
904
+ sections: Section[];
905
+ total: number;
906
+ }
903
907
  declare function useSections(): {
904
908
  sections: Section[];
905
909
  isLoading: boolean;
906
910
  isError: boolean;
907
911
  error: Error | null;
908
- refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Section[], Error>>;
912
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SectionsResponse, Error>>;
909
913
  };
910
914
 
911
915
  interface UseFormsOptions {
package/dist/index.js CHANGED
@@ -796,11 +796,11 @@ function useMySection(options = {}) {
796
796
  if (!sectionId) {
797
797
  throw new Error("User is not assigned to a section");
798
798
  }
799
- const section = await client.get(
799
+ const response = await client.get(
800
800
  `/orgs/api/organizations/${orgId}/sections/${sectionId}`,
801
801
  { includeMembers: includeMembers ? "true" : void 0 }
802
802
  );
803
- return section;
803
+ return "success" in response && response.data ? response.data : response;
804
804
  },
805
805
  enabled: isAuthenticated && !isUserLoading && !!sectionId,
806
806
  staleTime: 1e3 * 60 * 5
@@ -826,13 +826,14 @@ function useSections() {
826
826
  const query = reactQuery.useQuery({
827
827
  queryKey: ["axcloud", "sections", orgId, stage],
828
828
  queryFn: async () => {
829
- return client.get(`/orgs/api/organizations/${orgId}/sections`);
829
+ const response = await client.get(`/orgs/api/organizations/${orgId}/sections`);
830
+ return "success" in response && response.data ? response.data : response;
830
831
  },
831
832
  staleTime: 1e3 * 60 * 10
832
833
  // 10 minutes
833
834
  });
834
835
  return {
835
- sections: query.data ?? [],
836
+ sections: query.data?.sections ?? [],
836
837
  isLoading: query.isLoading,
837
838
  isError: query.isError,
838
839
  error: query.error,