| @@ -0,0 +1 @@ | |||
| REACT_APP_BASE_API_URL=https://trampa-api-test.dilig.net/ | |||
| @@ -13,7 +13,6 @@ | |||
| # misc | |||
| .DS_Store | |||
| .env | |||
| .env.local | |||
| .env.development.local | |||
| .env.test.local | |||
| @@ -172,7 +172,7 @@ export default { | |||
| product: "Proizvod", | |||
| }, | |||
| apiErrors: { | |||
| somethingWentWrong: "Greska sa serverom!", | |||
| somethingWentWrong: "Greška sa serverom!", | |||
| }, | |||
| header: { | |||
| addOffer: "Dodaj proizvod", | |||
| @@ -6,7 +6,8 @@ const request = axios.create({ | |||
| // baseURL: "http://192.168.88.175:3005/", | |||
| // baseURL: "http://192.168.88.143:3001/", // DULE | |||
| // baseURL: "https://trampa-api-test.dilig.net/", | |||
| baseURL: "http://localhost:3001/", | |||
| // baseURL: "http://localhost:3001/", | |||
| baseURL: process.env.REACT_APP_BASE_API_URL, | |||
| headers: { | |||
| "Content-Type": "application/json", | |||
| }, | |||
| @@ -1,7 +1,8 @@ | |||
| import io from "socket.io-client"; | |||
| // export const socket = io("https://trampa-api-test.dilig.net/", { | |||
| export const socket = io("http://localhost:3001/", { | |||
| // export const socket = io("http://localhost:3001/", { | |||
| export const socket = io(process.env.REACT_APP_BASE_API_URL, { | |||
| transports: ["websocket"], | |||
| reconnectionAttempts: 5, | |||
| }); | |||
| @@ -17,7 +17,8 @@ import { logoutUser, refreshUserToken } from "../actions/login/loginActions"; | |||
| // const baseURL = "http://192.168.88.175:3005/"; | |||
| // const baseURL = "https://trampa-api-test.dilig.net/"; | |||
| // const baseURL = "http://192.168.88.150:3001/"; // DJOLE | |||
| const baseURL = "http://localhost:3001/"; | |||
| // const baseURL = "http://localhost:3001/"; | |||
| const baseURL = process.env.REACT_APP_BASE_API_URL | |||
| //Interceptor unique name | |||
| export const accessTokensMiddlewareInterceptorName = "ACCESS_TOKEN_INTERCEPTOR"; | |||
| @@ -1,4 +1,6 @@ | |||
| import i18next from "i18next"; | |||
| import { attachPostRequestListener } from "../../request"; | |||
| import { makeErrorToastMessage } from "../utils/makeToastMessage"; | |||
| //Interceptor unique name | |||
| export const serverErrorMiddlewareInterceptorName = | |||
| @@ -7,12 +9,12 @@ export const serverErrorMiddlewareInterceptorName = | |||
| export default () => (next) => (action) => { | |||
| attachPostRequestListener((error) => { | |||
| if (!error.response) { | |||
| return Promise.reject(error); | |||
| return makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | |||
| } | |||
| if (error.response.status === 500) { | |||
| return "aaa"; | |||
| return makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | |||
| } | |||
| return Promise.reject(error); | |||
| return makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | |||
| }, serverErrorMiddlewareInterceptorName); | |||
| next(action); | |||