@omniumretail/shared-resources 0.1.9 → 0.1.11
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/Roles/get/useAllRolesQuery.hook.d.ts +1 -1
- package/package.json +1 -1
- package/src/hooks/Others/useApplicationDataQuery.hook.ts +1 -1
- package/src/hooks/Others/useContractStatesQuery.hook.ts +1 -1
- package/src/hooks/Others/useJobTitlesQuery.hook.ts +1 -1
- package/src/hooks/Roles/get/useAllRolesQuery.hook.ts +2 -2
- package/src/hooks/Users/get/useSingleUserIdQuery.hook.ts +1 -1
- package/src/hooks/Users/get/useUserListQuery.hook.ts +1 -1
- package/src/hooks/Users/mutate/useSingleUserIdMutateQuery.hook.ts +2 -2
- package/src/hooks/Users/others/useSingleUserResetPassword.hook.ts +1 -1
- package/src/hooks/Users/others/useUserBlockQuery.hook.ts +1 -1
- package/src/hooks/Users/others/useUserEmailVerifQuery.hook.ts +1 -1
- package/src/hooks/Users/others/useUserResetPassByEmail.hook.ts +1 -1
- package/src/services/ApiService/index.ts +1 -4
|
@@ -2,10 +2,10 @@ import { UseQueryOptions } from "@tanstack/react-query";
|
|
|
2
2
|
import { Roles, ResponseList } from "../../../interfaces";
|
|
3
3
|
interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
|
|
4
4
|
records: number | string;
|
|
5
|
+
page: number;
|
|
5
6
|
sortBy: string;
|
|
6
7
|
sortDirection: string;
|
|
7
8
|
tags?: string;
|
|
8
|
-
page: number;
|
|
9
9
|
}
|
|
10
10
|
export declare const useAllRolesQuery: ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Roles", Roles>, unknown>;
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -5,6 +5,6 @@ import { getAuth0 } from "../../services/ApiService";
|
|
|
5
5
|
export const useApplicationDataQueryHook = () => {
|
|
6
6
|
return useQuery(
|
|
7
7
|
['APPLICATIONS_QUERY'],
|
|
8
|
-
() => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/
|
|
8
|
+
() => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/Applications/groupByCategory')
|
|
9
9
|
);
|
|
10
10
|
}
|
|
@@ -9,6 +9,6 @@ interface ContractStatesQueryProps extends UseQueryOptions<ContractStates> {
|
|
|
9
9
|
export const useContractStatesQuery = ({ records }: ContractStatesQueryProps) => {
|
|
10
10
|
return useQuery(
|
|
11
11
|
['CONTRACTSTATES_QUERY', records],
|
|
12
|
-
() => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/
|
|
12
|
+
() => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/ContractStates`, { pPage: 1, pRecords: records || 195 })
|
|
13
13
|
);
|
|
14
14
|
}
|
|
@@ -9,6 +9,6 @@ interface JobTitlesQueryProps extends UseQueryOptions<JobTitles> {
|
|
|
9
9
|
export const useJobTitlesQuery = ({ records }: JobTitlesQueryProps) => {
|
|
10
10
|
return useQuery(
|
|
11
11
|
['JOBTITLES_QUERY', records],
|
|
12
|
-
() => getAuth0<ResponseList<"JobTitles", JobTitles>>(`/
|
|
12
|
+
() => getAuth0<ResponseList<"JobTitles", JobTitles>>(`/JobTitles`, { pPage: 1, pRecords: records || 195 })
|
|
13
13
|
);
|
|
14
14
|
}
|
|
@@ -4,16 +4,16 @@ import { getAuth0 } from "../../../services";
|
|
|
4
4
|
|
|
5
5
|
interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
|
|
6
6
|
records: number | string;
|
|
7
|
+
page: number;
|
|
7
8
|
sortBy: string;
|
|
8
9
|
sortDirection: string;
|
|
9
10
|
tags?: string;
|
|
10
|
-
page: number;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const useAllRolesQuery = ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => {
|
|
14
14
|
const queryKey = ['ROLES_QUERY', records, sortBy, sortDirection, tags, page];
|
|
15
15
|
|
|
16
|
-
const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/
|
|
16
|
+
const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/Roles`, {
|
|
17
17
|
pPage: page || 1,
|
|
18
18
|
pRecords: records || 50,
|
|
19
19
|
pSortBy: sortBy,
|
|
@@ -5,7 +5,7 @@ import { getAuth0 } from "../../../services/ApiService";
|
|
|
5
5
|
export const useSingleUserIdQueryHook = (userId: string) => {
|
|
6
6
|
return useQuery(
|
|
7
7
|
['SINGLE_USER_ID_QUERY', userId],
|
|
8
|
-
() => getAuth0<User>(`/
|
|
8
|
+
() => getAuth0<User>(`/Users/${userId}`),
|
|
9
9
|
{
|
|
10
10
|
enabled: !!(userId),
|
|
11
11
|
},
|
|
@@ -14,7 +14,7 @@ export interface UserListQuery extends UseQueryOptions<ResponseList<"Users", Use
|
|
|
14
14
|
export const useUserListQueryHook = ({ tags, page, records, queryField, sortBy, sortDirection }: UserListQuery) => {
|
|
15
15
|
return useQuery(
|
|
16
16
|
['USER_LIST_QUERY', tags, page, records, sortBy, sortDirection, queryField],
|
|
17
|
-
() => getAuth0<ResponseList<"Users", User>>('/
|
|
17
|
+
() => getAuth0<ResponseList<"Users", User>>('/Users', {
|
|
18
18
|
pPage: page || 1,
|
|
19
19
|
pRecords: records || 50,
|
|
20
20
|
pSortBy: sortBy || 'DisplayName',
|
|
@@ -7,8 +7,8 @@ export const useSingleUserIdMutateQuery = (bodyType?: string) => {
|
|
|
7
7
|
return useMutation<SingleUser, unknown, SingleUser>((data: SingleUser | any) => {
|
|
8
8
|
const userId = bodyType === 'formdata' ? data.get('UserId') : data.UserId
|
|
9
9
|
return userId
|
|
10
|
-
? putAuth0(`/
|
|
11
|
-
: postAuth0('/
|
|
10
|
+
? putAuth0(`/Users/${userId}`, undefined, data, bodyType)
|
|
11
|
+
: postAuth0('/Users/', undefined, data, bodyType);
|
|
12
12
|
}, {
|
|
13
13
|
onSuccess: (data: SingleUser) => {
|
|
14
14
|
queryClient.setQueryData(
|
|
@@ -9,7 +9,7 @@ interface UserWithResetPasswordURL extends User {
|
|
|
9
9
|
export const useSingleUserResetPasswordHook = () => {
|
|
10
10
|
const queryClient = useQueryClient();
|
|
11
11
|
return useMutation<UserWithResetPasswordURL, unknown, UserWithResetPasswordURL>((data: UserWithResetPasswordURL) => {
|
|
12
|
-
return postAuth0(`/
|
|
12
|
+
return postAuth0(`/Users/${data.UserId}/resetPassword`);
|
|
13
13
|
}, {
|
|
14
14
|
onSuccess: (data: UserWithResetPasswordURL) => {
|
|
15
15
|
queryClient.setQueryData(['USER_RESET_PASSWORD_QUERY'], data);
|
|
@@ -5,7 +5,7 @@ import { putAuth0 } from "../../../services/ApiService";
|
|
|
5
5
|
export const useUserBlockQueryHook = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<User, unknown, User>((data: User) => {
|
|
8
|
-
return putAuth0(`/
|
|
8
|
+
return putAuth0(`/Users/${data.UserId}/block`)
|
|
9
9
|
}, {
|
|
10
10
|
onSuccess: (data: User) => {
|
|
11
11
|
queryClient.setQueryData(
|
|
@@ -5,7 +5,7 @@ import { postAuth0 } from "../../../services/ApiService";
|
|
|
5
5
|
export const useUserEmailVerifQueryHook = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<User, unknown, User>((data: User) => {
|
|
8
|
-
return postAuth0(`/
|
|
8
|
+
return postAuth0(`/Users/${data.UserId}/sendVerificationEmail`)
|
|
9
9
|
}, {
|
|
10
10
|
onSuccess: (data: User) => {
|
|
11
11
|
queryClient.setQueryData(
|
|
@@ -5,7 +5,7 @@ import { postAuth0 } from "../../../services/ApiService";
|
|
|
5
5
|
export const useUserResetPassByEmailHook = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
return useMutation<User, unknown, User>((data: User) => {
|
|
8
|
-
return postAuth0(`/
|
|
8
|
+
return postAuth0(`/Users/${data.UserId}/resetPasswordEmail`);
|
|
9
9
|
}, {
|
|
10
10
|
onSuccess: (data: User) => {
|
|
11
11
|
queryClient.setQueryData(['USER_RESET_PASSWORD_BY_EMAIL_QUERY'], data);
|
|
@@ -13,7 +13,7 @@ export const putAuth0 = <T>(path: string, params?: Record<string, unknown>, body
|
|
|
13
13
|
return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'PUT', body, bodyType);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const postAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown,bodyType?: string): Promise<T> => {
|
|
16
|
+
export const postAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string): Promise<T> => {
|
|
17
17
|
return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'POST', body, bodyType);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -91,9 +91,6 @@ const buildApiRequestForAuth0 = <T>(path: string, method = 'GET', data?: unknown
|
|
|
91
91
|
Authorization: appConfig.tokenAuth0 ? `Bearer ${appConfig.tokenAuth0}` : undefined,
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
console.log(appConfig.tokenAuth0);
|
|
95
|
-
console.log(headers);
|
|
96
|
-
|
|
97
94
|
let body: FormData | string | undefined | any;
|
|
98
95
|
|
|
99
96
|
if (['POST', 'PUT'].includes(method)) {
|