Skip to content

Commit

Permalink
Use transport API server without Vercel rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin committed Dec 3, 2023
1 parent 9147120 commit 27e1c3f
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 114 deletions.
8 changes: 4 additions & 4 deletions client/api/masstrans/masstrans.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createStrapiMethods } from 'transport-common/strapi/create-methods';
import { TRANSPORT_API_URL } from 'transport-common/strapi/constants';
import { StrapiContentTypes, StrapiStop, StrapiUnitInfo } from 'transport-common/types/strapi';

import { ClientUnit, Route, StopInfoItem, UnitArriveStop } from 'transport-common/types/masstrans';
import { fetchApi } from 'api/utils/fetch';

Expand All @@ -9,7 +9,7 @@ const strapiUnitInfo = createStrapiMethods(StrapiContentTypes.UnitInfo);

export const massTransApi = {
getVehicles: (type: ClientUnit) =>
fetchApi(`/api/masstrans/${type}`, {
fetchApi(`${TRANSPORT_API_URL}/api/masstrans/${type}`, {
dataField: 'data',
cache: 'no-store',
}),
Expand Down Expand Up @@ -41,12 +41,12 @@ export const massTransApi = {
) as Promise<StrapiUnitInfo[]>;
},
getRoute: (routeId: number) =>
fetchApi(`/api/masstrans/route/${routeId}`, {
fetchApi(`${TRANSPORT_API_URL}/api/masstrans/route/${routeId}`, {
dataField: 'data',
cache: 'no-store',
}) as Promise<Route>,
getStopInfo: (stopId: string) =>
fetchApi(`/api/masstrans/stop/${stopId}`, {
fetchApi(`${TRANSPORT_API_URL}/api/masstrans/stop/${stopId}`, {
dataField: 'data',
cache: 'no-store',
}) as Promise<StopInfoItem[]>,
Expand Down
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"ekb": "^1.1.3",
"express": "^4.18.2",
"figma-squircle": "^0.3.1",
"http-proxy-middleware": "^2.0.6",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"markdown-it": "^13.0.1",
Expand Down
12 changes: 10 additions & 2 deletions common/strapi/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
export const SITE_URL = 'https://transport.ekaterinburg.city';
const IS_PRODUCTION = process.env.NODE_ENV === 'production';

export const SITE_URL = IS_PRODUCTION
? 'https://transport.ekaterinburg.city'
: `http://localhost:${process.env.PORT || 3000}`;

export const TRANSPORT_API_URL = IS_PRODUCTION
? 'https://transport-api.ekaterinburg.city'
: `http://localhost:${process.env.APP_PORT || 3080}`;

export const STRAPI_URL = 'https://transport-cms.ekaterinburg.city';
export const TRANSPORT_API_URL = 'https://transport-api.ekaterinburg.city';
export const TILE_SERVER_URL = 'https://tiles.ekaterinburg.city';
export const TRAFFIC_JAMS_URL = 'https://ekb-probki.vercel.app/api';

Expand Down
Loading

0 comments on commit 27e1c3f

Please sign in to comment.