Fixed ports
This commit is contained in:
@@ -2,8 +2,6 @@ const express = require('express');
|
||||
const fallback = require('express-history-api-fallback');
|
||||
const compression = require('compression');
|
||||
|
||||
const PORT = process.env.$PORT || process.env.PORT || 8080;
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(compression());
|
||||
@@ -12,4 +10,4 @@ app.use(express.static(`${__dirname}/build`));
|
||||
|
||||
app.use(fallback(`${__dirname}/build/index.html`));
|
||||
|
||||
app.listen(PORT);
|
||||
app.listen(process.env.PORT || 8080);
|
||||
|
||||
@@ -23,10 +23,12 @@ const useQuery = (url, propsVariables = {}, options = {}) => {
|
||||
});
|
||||
|
||||
const makeRequest = useCallback(
|
||||
(newVariables, { skipLoading } = {}) => {
|
||||
newVariables => {
|
||||
const variables = { ...state.variables, ...(newVariables || {}) };
|
||||
const apiVariables = { ...propsVariablesMemoized, ...variables };
|
||||
|
||||
const skipLoading = canUseCache && cachePolicy === 'cache-first';
|
||||
|
||||
if (!skipLoading) {
|
||||
mergeState({ isLoading: true, variables });
|
||||
} else if (newVariables) {
|
||||
@@ -53,20 +55,16 @@ const useQuery = (url, propsVariables = {}, options = {}) => {
|
||||
if (isSleeping) return;
|
||||
if (canUseCache && cachePolicy === 'cache-only') return;
|
||||
|
||||
makeRequest(
|
||||
{},
|
||||
{
|
||||
skipLoading: canUseCache && cachePolicy === 'cache-first',
|
||||
},
|
||||
);
|
||||
makeRequest();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [makeRequest]);
|
||||
|
||||
const setLocalData = useCallback(
|
||||
getUpdatedData =>
|
||||
mergeState(({ data }) => {
|
||||
cache[url] = { ...(cache[url] || {}), data: getUpdatedData(data) };
|
||||
return { data: getUpdatedData(data) };
|
||||
const updatedData = getUpdatedData(data);
|
||||
cache[url] = { ...(cache[url] || {}), data: updatedData };
|
||||
return { data: updatedData };
|
||||
}),
|
||||
[mergeState, url],
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { objectToQueryString } from 'shared/utils/url';
|
||||
import { getStoredAuthToken, removeStoredAuthToken } from 'shared/utils/authToken';
|
||||
|
||||
const defaults = {
|
||||
baseURL: 'http://localhost:3000',
|
||||
baseURL: `http://localhost:${process.env.PORT || 3000}`,
|
||||
headers: () => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: getStoredAuthToken() ? `Bearer ${getStoredAuthToken()}` : undefined,
|
||||
|
||||
Reference in New Issue
Block a user