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
2 changes: 1 addition & 1 deletion mock/data/mockCuries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export const mockCuries = () => { return [{
rdfs: "http://www.w3.org/2000/01/rdf-schema#",
owl: "http://www.w3.org/2002/07/owl#"
}]
}
}
39 changes: 39 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,45 @@ server {
add_header Access-Control-Allow-Credentials true always;
}

location ~ ^/[^/]+/[^/]+/ontologies$ {
proxy_pass https://uri.olympiangods.org;
proxy_set_header Host uri.olympiangods.org;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_verify off;

# CORS headers
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
}

location ~ ^/[^/]+/[^/]+/curies$ {
proxy_pass https://uri.olympiangods.org;
proxy_set_header Host uri.olympiangods.org;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_verify off;

# CORS headers
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
}

location ~ ^/[^/]+/[^/]+/contributions$ {
proxy_pass https://uri.olympiangods.org;
proxy_set_header Host uri.olympiangods.org;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_verify off;

# CORS headers
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
}

# Handle 303 redirects for spec endpoint
location @handle_303 {
internal;
Expand Down
20 changes: 20 additions & 0 deletions src/api/endpoints/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,31 @@ export const getOrganizations = (group: string) => {
return createGetRequest<any, any>(endpoint, "application/json")();
};

export const getOrganizationsCuries = (group: string) => {
const endpoint = `/${group}${API_CONFIG.REAL_API.ORG_CURIES}`;
return createGetRequest<any, any>(endpoint, "application/json")();
};

export const getOrganizationsTerms = (group: string) => {
const endpoint = `/${group}${API_CONFIG.REAL_API.ORG_TERMS}`;
return createGetRequest<any, any>(endpoint, "application/json")();
};

export const getOrganizationsOntologies = (group: string) => {
const endpoint = `/${group}${API_CONFIG.REAL_API.ORG_ONTOLOGIES}`;
return createGetRequest<any, any>(endpoint, "application/json")();
};

export const userLogout = (group: string) => {
const endpoint = `/${group}${API_CONFIG.REAL_API.LOGOUT}`;
return createGetRequest<any, any>(endpoint, "application/json")();
};

export const changePassword = (group: string, data: { username: string; currentPassword: string; newPassword: string }) => {
const endpoint = `/${group}${API_CONFIG.REAL_API.PASSWORD_CHANGE}`;
return createPostRequest<any, any>(endpoint, { "Content-Type": "application/x-www-form-urlencoded" })(data);
};

export const getSelectedTermLabel = async (searchTerm: string, group: string = 'base'): Promise<{ label: string | undefined; actualGroup: string }> => {
try {
const response = await createGetRequest<JsonLdResponse, any>(`/${group}/${searchTerm}.jsonld`)();
Expand Down
13 changes: 6 additions & 7 deletions src/api/endpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import termParser, { elasticSearchParser, getTerm } from '../../parsers/termPars
import axios from 'axios';
import { API_CONFIG } from '../../config';

const useMockApi = () => mockApi;
const useApi = () => api;
const useMockApi = () => mockApi;

const BASE_GROUP = "base";
const BASE_EXTENSION = "jsonld";

export const getOrganizations = async (group) => {
Expand Down Expand Up @@ -219,7 +218,7 @@ export const searchAll = async (term, filters = {}) => {
const { searchAll } = useMockApi();

/** Call Endpoint */
return searchAll("base", term, filters).then((data) => {
return searchAll("base", term, filters).then((data: any) => {
let terms = termParser((data as any).terms, term, filters);
terms?.results?.forEach( result => {
result.type = TERM;
Expand All @@ -244,7 +243,7 @@ export const patchTerm = async (group, termID, term) => {
const {patchEndpointsIlx} = useApi();

/** Call Endpoint */
return patchEndpointsIlx(group, termID, term).then((data) => {
return patchEndpointsIlx(group, termID, term).then((data: any) => {
let termParsed = getTerm(data.data);
let response = {
status : data.status,
Expand Down Expand Up @@ -291,7 +290,7 @@ export const bulkEditTerms = async (group, payload) => {
const { bulkEditTerms } = useMockApi();

/** Call Endpoint */
return bulkEditTerms(group, payload).then((data) => {
return bulkEditTerms(group, payload).then((data: any) => {
let termsParsed = termParser(data.data, undefined);
let response = {
status : data.status,
Expand All @@ -309,7 +308,7 @@ export const getEndpointsIlx = async (group, term) => {
const { getEndpointsIlx } = useApi();

/** Call Endpoint */
return getEndpointsIlx(group,term).then((data) => {
return getEndpointsIlx(group, term, BASE_EXTENSION).then((data) => {
return termParser(data, term);
})
.catch((error) => {
Expand Down Expand Up @@ -414,7 +413,7 @@ export const handleLogin = async (username: string, password: string) => {
};

export const handleOrcidLogin = async (code: string) => {
const response = await fetch("https://uri.olympiangods.org/u/ops/orcid-login", {
const response = await fetch(`${API_CONFIG.OLYMPIAN_GODS}/u/ops/orcid-login`, {
method: "POST",
headers: { "Content-Type": "application/json" },
// body: JSON.strijiuigngify({ code }),
Expand Down
Loading