@openmrs/esm-stock-management-app 1.0.1-pre.350 → 1.0.1-pre.357

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,13 +2,13 @@ import useSWR from "swr";
2
2
  import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
3
3
  import { PageableResult } from "../core/api/types/PageableResult";
4
4
  import { UserRoleScope } from "../core/api/types/identity/UserRoleScope";
5
- import { openmrsFetch } from "@openmrs/esm-framework";
5
+ import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
6
6
 
7
7
  export type UserRoleScopeFilter = ResourceFilterCriteria;
8
8
 
9
9
  // getUserRoleScopes
10
10
  export function useUserRoleScopes(filter: UserRoleScopeFilter) {
11
- const apiUrl = `ws/rest/v1/stockmanagement/userrolescope${toQueryParams(
11
+ const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope${toQueryParams(
12
12
  filter
13
13
  )}`;
14
14
  const { data, error, isLoading } = useSWR<
@@ -24,7 +24,7 @@ export function useUserRoleScopes(filter: UserRoleScopeFilter) {
24
24
 
25
25
  // getUserRoleScope
26
26
  export function useUserRoleScope(id: string) {
27
- const apiUrl = `ws/rest/v1/stockmanagement/userrolescope/${id}`;
27
+ const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope/${id}`;
28
28
  const { data, error, isLoading } = useSWR<{ data: UserRoleScope }, Error>(
29
29
  apiUrl,
30
30
  openmrsFetch
@@ -46,7 +46,7 @@ export function deleteUserRoleScopes(ids: string[]) {
46
46
  if (otherIds.length > 0) {
47
47
  otherIds = "?ids=" + otherIds;
48
48
  }
49
- const apiUrl = `ws/rest/v1/stockmanagement/userrolescope/${ids[0]}${otherIds}`;
49
+ const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope/${ids[0]}${otherIds}`;
50
50
  const abortController = new AbortController();
51
51
 
52
52
  return openmrsFetch(apiUrl, {
@@ -62,7 +62,7 @@ export function deleteUserRoleScopes(ids: string[]) {
62
62
  export function createOrUpdateUserRoleScope(item: UserRoleScope) {
63
63
  const abortController = new AbortController();
64
64
  const isNew = item.uuid != null;
65
- const apiUrl = `ws/rest/v1/stockmanagement/userrolescope${
65
+ const apiUrl = `${restBaseUrl}/stockmanagement/userrolescope${
66
66
  isNew ? "/" + item.uuid : ""
67
67
  }`;
68
68
  return openmrsFetch(apiUrl, {