· 6 years ago · Jan 14, 2019, 02:40 PM
1function hostPath() {
2 switch (process.env.NODE_ENV) {
3 case "development":
4 return "http://localhost:8080";
5 case "production":
6 return window.location.protocol + "//" + process.env.REACT_APP_BACKEND;
7 default:
8 return "error";
9 }
10
11}
12
13
14export const allCitiesURL = hostPath() + "/cities";
15export const loginVerifierURL = hostPath() + "/oauth/token";
16export const currentUserURL = hostPath() + "/user";
17export const pictureURL = hostPath() + "/picture";
18export const ratingURL = hostPath() + "/rating";
19export const commentsURL = hostPath() + "/comment";
20export const registerURL = hostPath() + "/register";
21export function menzaByCityIdURL(id) {return hostPath() + `/city/${id}/menze`}
22export function menzaByIdURL(id) {return hostPath() + `/menza?id=${id}`}
23export function dailyOfferByMenzaId(id) {return hostPath() + `/menza/${id}/dailyoffer`}
24export function menzaMealById(id) { return hostPath() + `/menzameal?id=${id}`}
25export function commentByMenzaMealId(id) { return hostPath() + `/menzameal/${id}/comments`}
26export function avgratingURL(id) { return hostPath() + `/menzameal/${id}/rating`}
27export function authorizationURL() { return hostPath() + "/oauth/token"}