diff --git a/web/app/analyze/[owner]/image.tsx b/web/app/analyze/[owner]/image.tsx index c3503523..83466e21 100644 --- a/web/app/analyze/[owner]/image.tsx +++ b/web/app/analyze/[owner]/image.tsx @@ -21,12 +21,12 @@ export default async function Image ({ params }: { params: { owner: string } }) ] = await Promise.all([ Promise.all(['stars', 'pull-requests', 'issues', 'reviews'].map(dim => - fetch(`https://api.ossinsight.io/q/orgs/${dim}/total?ownerId=${info.id}&period=past_28_days`) + fetch(`/queries/orgs/${dim}/total?ownerId=${info.id}&period=past_28_days`) .then(res => res.json()) .then(data => data.data[0]?.current_period_total ?? 0), )), Promise.all(['active', 'new'].map(dim => - fetch(`https://api.ossinsight.io/q/orgs/participants/${dim}/ranking?ownerId=${info.id}&activity=${dim}&period=past_28_days`) + fetch(`/queries/orgs/participants/${dim}/ranking?ownerId=${info.id}&activity=${dim}&period=past_28_days`) .then(res => res.json()) .then(data => data.data.slice(0, 5)), )), diff --git a/web/components/Analyze/utils.ts b/web/components/Analyze/utils.ts index b0b48e32..bcadde63 100644 --- a/web/components/Analyze/utils.ts +++ b/web/components/Analyze/utils.ts @@ -2,14 +2,14 @@ import { handleOApi } from '@ossinsight/widgets-core/src/utils/oapi'; const API_SERVER = 'https://api.ossinsight.io'; const PATH_GET_ORG_INFO = `/q/get-user-by-login`; -const PATH_GET_ORG_OVERVIEW = `/q/orgs/overview`; -const PATH_GET_ORG_STARS_LOCATIONS = `/q/orgs/stars/locations`; -const PATH_GET_ORG_STARS_ORGS = `/q/orgs/stars/organizations`; -const PATH_GET_ORG_PARTICIPANT_LOCATIONS = `/q/orgs/participants/locations`; -const PATH_GET_ORG_PARTICIPANT_ORGS = `/q/orgs/participants/organizations`; +const PATH_GET_ORG_OVERVIEW = `/queries/orgs/overview`; +const PATH_GET_ORG_STARS_LOCATIONS = `/queries/orgs/stars/locations`; +const PATH_GET_ORG_STARS_ORGS = `/queries/orgs/stars/organizations`; +const PATH_GET_ORG_PARTICIPANT_LOCATIONS = `/queries/orgs/participants/locations`; +const PATH_GET_ORG_PARTICIPANT_ORGS = `/queries/orgs/participants/organizations`; const PATH_GET_USERS = `/gh/users/`; const PATH_GET_REPO_BY_ID = `/gh/repositories/`; -const PATH_GET_FILLED_RATIO = `/q/orgs/{activity}/{target}/completion-rate`; +const PATH_GET_FILLED_RATIO = `/queries/orgs/{activity}/{target}/completion-rate`; export interface OwnerInfo { type: 'User' | 'Organization' | 'Bot'; @@ -31,7 +31,7 @@ export const getOrgInfo = (login: string) => { }; export const getOrgOverview = (id: number, signal?: AbortSignal) => { - return fetch(`${API_SERVER}${PATH_GET_ORG_OVERVIEW}?ownerId=${id}`, { signal }) + return fetch(`${PATH_GET_ORG_OVERVIEW}?ownerId=${id}`, { signal }) .then(handleOApi); }; @@ -77,7 +77,7 @@ export const getOrgActivityLocations = ( const paramsStr = params2UrlSearch({ ...params, ownerId: id }); - return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal }) + return fetch(`${path}?${paramsStr}`, { signal }) .then(handleOApi); }; @@ -109,7 +109,7 @@ export const getOrgActivityOrgs = ( path = PATH_GET_ORG_PARTICIPANT_ORGS; } - return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal }) + return fetch(`${path}?${paramsStr}`, { signal }) .then(handleOApi); }; @@ -135,7 +135,7 @@ export const getCompletionRate = ( path = path.replace('{activity}', params?.activity || 'stars'); path = path.replace('{target}', params?.target || 'organizations'); - return fetch(`${API_SERVER}${path}?${paramsStr}`, { signal }).then( + return fetch(`${path}?${paramsStr}`, { signal }).then( handleOApi ); };