local docker config (dev) fixed

This commit is contained in:
SamR1
2018-01-14 12:48:52 +01:00
parent 2a83d7e105
commit c07e5c9608
15 changed files with 46 additions and 108 deletions

View File

@ -5,21 +5,21 @@ RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# add environment variables
ARG REACT_APP_USERS_SERVICE_URL
ARG REACT_APP_API_URL
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
ENV REACT_APP_API_URL $REACT_APP_API_URL
# install and cache app dependencies
ADD package.json /usr/src/app/package.json
RUN npm install --silent
RUN npm install react-scripts -g
RUN yarn install --silent
RUN yarn global add react-scripts
# add app
ADD . /usr/src/app/
# start app
CMD ["npm", "start"]
CMD yarn start

View File

@ -1,25 +0,0 @@
FROM node:latest
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# add environment variables
ARG REACT_APP_USERS_SERVICE_URL
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
# install and cache app dependencies
ADD package.json /usr/src/app/package.json
RUN npm install --silent
RUN npm install react-scripts -g
# add app
ADD . /usr/src/app/
# start app
CMD ["npm", "start"]

View File

@ -1,35 +1,4 @@
{
"name": "mpwo_client",
"version": "0.1.0",
"private": true,
"dependencies": {
"date-fns": "^1.29.0",
"history": "^4.7.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-helmet": "^5.2.0",
"react-key-index": "^0.1.1",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
},
"scripts": {
"start": "cd mpwo_client && react-scripts start",
"build": "cd mpwo_client && react-scripts build",
"test": "cd mpwo_client && testcafe firefox e2e",
"eject": "cd mpwo_client && react-scripts eject",
"lint": "cd mpwo_client && eslint --cache --ext .jsx --ext .js src"
},
"devDependencies": {
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-testcafe": "^0.2.1",
"randomstring": "^1.1.5",
"testcafe": "^0.18.6"
}
"version": "0.1.0"
}

View File

@ -1,7 +1,7 @@
import keyIndex from 'react-key-index'
import mpwoApi from '../mpwoApi'
import { history } from '../index'
import { generateIds } from '../utils'
function AuthError(message) {
return { type: 'AUTH_ERROR', message }
@ -138,7 +138,7 @@ export function handleUserFormSubmit(event, formType) {
if (ret.length === 0) {
dispatch(register(formData.formData))
} else {
dispatch(AuthErrors(keyIndex(ret, 1)))
dispatch(AuthErrors(generateIds(ret)))
}
}
}

View File

@ -1,6 +1,5 @@
const apiUrl = `${process.env.REACT_APP_API_URL}`
export default class MpwoApi {
static login(email, password) {
const request = new Request(`${apiUrl}auth/login`, {

View File

@ -1 +1,13 @@
export const isLoggedIn = () => !!window.localStorage.authToken
export function generateIds(arr) {
let i = 0
let arrWithIds = arr.map(arr => {
const obj = { id: i, value: arr }
i++
return obj
})
return arrWithIds
}