From 110ed37650afb9b1ebec94142ed853cffec9c5bd Mon Sep 17 00:00:00 2001 From: tima101 Date: Fri, 26 Apr 2019 12:41:55 -0700 Subject: [PATCH] properly defined PRODUCTION_URL_APP on client #18 --- README.md | 3 +-- app/components/discussions/CreateDiscussionForm.tsx | 6 ++++-- app/components/posts/PostForm.tsx | 6 ++++-- app/pages/_document.tsx | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7300fe15..9f471e9b 100644 --- a/README.md +++ b/README.md @@ -178,8 +178,7 @@ To deploy the two apps (`api` and `app`), follow the instructions below. "PRODUCTION_URL_API": "https://your-api-url.com", "BUCKET_FOR_POSTS": "xxxxxx", "BUCKET_FOR_TEAM_AVATARS": "xxxxxx", - "LAMBDA_API_ENDPOINT": "xxxxxx", - + "LAMBDA_API_ENDPOINT": "xxxxxx", }, "alias": "your-app-url.com", "scale": { diff --git a/app/components/discussions/CreateDiscussionForm.tsx b/app/components/discussions/CreateDiscussionForm.tsx index 28747deb..f9f70fda 100644 --- a/app/components/discussions/CreateDiscussionForm.tsx +++ b/app/components/discussions/CreateDiscussionForm.tsx @@ -13,13 +13,15 @@ import Router from 'next/router'; import NProgress from 'nprogress'; import React from 'react'; +import env from '../../lib/env'; + import notify from '../../lib/notifier'; import { Store } from '../../lib/store'; import PostEditor from '../posts/PostEditor'; import MemberChooser from '../users/MemberChooser'; -const dev = process.env.NODE_ENV !== 'production'; -const { PRODUCTION_URL_APP } = process.env; +const { NODE_ENV, PRODUCTION_URL_APP } = env; +const dev = NODE_ENV !== 'production'; const URL_APP = dev ? 'http://localhost:3000' : PRODUCTION_URL_APP; const styles = { diff --git a/app/components/posts/PostForm.tsx b/app/components/posts/PostForm.tsx index 7d3a611b..d9fffef3 100644 --- a/app/components/posts/PostForm.tsx +++ b/app/components/posts/PostForm.tsx @@ -6,13 +6,15 @@ import { inject, observer } from 'mobx-react'; import NProgress from 'nprogress'; import React from 'react'; +import env from '../../lib/env'; + import notify from '../../lib/notifier'; import { Discussion, Post, Store, User } from '../../lib/store'; import PostEditor from './PostEditor'; -const dev = process.env.NODE_ENV !== 'production'; -const { PRODUCTION_URL_APP } = process.env; +const { NODE_ENV, PRODUCTION_URL_APP } = env; +const dev = NODE_ENV !== 'production'; const URL_APP = dev ? 'http://localhost:3000' : PRODUCTION_URL_APP; const styles = { diff --git a/app/pages/_document.tsx b/app/pages/_document.tsx index d62a09d9..1c9ad344 100644 --- a/app/pages/_document.tsx +++ b/app/pages/_document.tsx @@ -4,6 +4,7 @@ import React from 'react'; import flush from 'styled-jsx/server'; const { + NODE_ENV, GA_TRACKING_ID, PRODUCTION_URL_APP, PRODUCTION_URL_API, @@ -14,6 +15,7 @@ const { } = process.env; const env = { + NODE_ENV, GA_TRACKING_ID, PRODUCTION_URL_APP, PRODUCTION_URL_API,