Browse Source

Add .env file with backend route.

Tatiana Inama 6 năm trước cách đây
mục cha
commit
8e4da6d913
2 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 1 0
      .gitignore
  2. 3 2
      src/Admin.tsx

+ 1 - 0
.gitignore

@@ -13,6 +13,7 @@
 
 # misc
 .DS_Store
+.env
 .env.local
 .env.development.local
 .env.test.local

+ 3 - 2
src/Admin.tsx

@@ -6,6 +6,8 @@ import Axios from 'axios';
 import VALUES, { AgeVal, GenderVal, NonNativeVal, Filters, FilterVal, FilterStatus, EducationVal } from './services';
 import './Admin.css';
 
+const BACKEND = process.env.REACT_APP_BACKEND || '/backend/';
+
 type PersonalInformation = {
   age: AgeVal,
   gender: GenderVal,
@@ -129,8 +131,7 @@ class Admin extends React.Component<{}, AdminState> {
     const canvas = new PaperScope();
     canvas.setup('vom-admin-canvas');
     canvas.view.viewSize.height = canvas.view.size.width * 1.25;
-    Axios.get<Result[]>('/backend/').then(response => {
-    // Axios.get<Result[]>('https://voicesofmerseyside.inama.dev/backend/').then(response => {
+    Axios.get<Result[]>(BACKEND).then(response => {
       const _data = response.data.map((result, index) => {
         return {
           ...result,