@omniumretail/shared-resources 0.1.87 → 0.1.88

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.
@@ -1,2 +1,9 @@
1
1
  import { UseQueryOptions } from '@tanstack/react-query';
2
- export declare const useRegulationQueryHook: (userId: string, { ...options }: UseQueryOptions) => import("@tanstack/react-query").UseQueryResult<unknown, unknown>;
2
+ interface TermsAndConditionsURLProps {
3
+ TermsAndConditionsURL: string;
4
+ }
5
+ export interface RegulationQueryProps extends UseQueryOptions<TermsAndConditionsURLProps> {
6
+ userId: string;
7
+ }
8
+ export declare const useRegulationQueryHook: ({ userId }: RegulationQueryProps) => import("@tanstack/react-query").UseMutationResult<RegulationQueryProps, unknown, string, unknown>;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.87",
3
+ "version": "0.1.88",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -1,14 +1,22 @@
1
1
  import { putAuth0 } from '../..';
2
- import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
+ import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
3
3
 
4
- interface RegulationQueryProps {
4
+ interface TermsAndConditionsURLProps {
5
5
  TermsAndConditionsURL: string;
6
+
7
+ }
8
+
9
+ export interface RegulationQueryProps extends UseQueryOptions<TermsAndConditionsURLProps> {
10
+ userId: string;
6
11
  }
7
12
 
8
- export const useRegulationQueryHook = (userId: string, {...options} : UseQueryOptions) => {
9
- return useQuery(
10
- ['USE_REGULATION_QUERY', userId],
11
- () => putAuth0<RegulationQueryProps>(`/AACP/Users/${userId}/termsAndConditions`),
12
- options
13
- );
13
+ export const useRegulationQueryHook = ({ userId }: RegulationQueryProps) => {
14
+ const queryClient = useQueryClient();
15
+ return useMutation<RegulationQueryProps, unknown, string>(() => {
16
+ return putAuth0(`/AACP/Users/${userId}/termsAndConditions`);
17
+ }, {
18
+ onSuccess: (data: RegulationQueryProps) => {
19
+ queryClient.setQueryData(['PUT_REGULATION_QUERY'], data);
20
+ },
21
+ });
14
22
  };