Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions src/api/endpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ const useApi = () => api;
const BASE_GROUP = "base";
const BASE_EXTENSION = "jsonld";

export const getOrganizations = async () => {
/** Call endpoint for retrieving organizations, this is a mock endpoint
created by us */
const { getOrganizations } = useMockApi();
export const getOrganizations = async (group) => {
const { getPrivRoleOtherGroup } = useApi();

/** Call Endpoint */
return await getOrganizations().then((data) => {
return data as Organizations;
return await getPrivRoleOtherGroup(group).then((data) => {
return data;
})
.catch((error) => {
return error;
});
}

export const getOrganization = async (id) => {
/** Call endpoint for retrieving organizations, this is a mock endpoint
created by us */
const { getOrganization } = useMockApi();

/** Call Endpoint */
Expand All @@ -42,8 +38,6 @@ export const getOrganization = async (id) => {
}

export const getOrganizationTerms = async (id) => {
/** Call endpoint for retrieving organizations, this is a mock endpoint
created by us */
const { getOrganizationsTerms } = useMockApi();

/** Call Endpoint */
Expand All @@ -55,6 +49,19 @@ export const getOrganizationTerms = async (id) => {
});
}

export const newOrganization = async (organization) => {
const { postPrivOrgNew } = useApi();

/** Call Endpoint */
return postPrivOrgNew(organization).then((response) => {
console.log("Post new organization ", response)
return response
})
.catch((error) => {
return error;
});
}

export const getOrganizationCuries = async (id) => {
const { getOrganizationsCuries } = useMockApi();

Expand Down Expand Up @@ -206,10 +213,10 @@ export const searchAll = async (term, filters = {}) => {
}

export const patchTerm = async (group, termID, term) => {
const patchEndpointsIlx= "";
const {patchEndpointsIlx} = useApi();

/** Call Endpoint */
return patchEndpointsIlx(group, termID).then((data) => {
return patchEndpointsIlx(group, termID, term).then((data) => {
let termParsed = getTerm(data.data);
let response = {
status : data.status,
Expand All @@ -224,10 +231,10 @@ export const patchTerm = async (group, termID, term) => {
}

export const addTerm = async (group, term) => {
const { addTerm } = useMockApi();
const { postPrivEntityNew } = useApi();

/** Call Endpoint */
return addTerm(group, term).then((data) => {
return postPrivEntityNew(group, term).then((data) => {
let termParsed = getTerm(data.data);
let response = {
status : data.status,
Expand Down
Loading
Loading