Skip to content

Commit

Permalink
Dev: Add BIT backend heroku url
Browse files Browse the repository at this point in the history
add heroku specific branch on fork repo

Refactor homepage url to fork repo for test

remove extra backslash

add CORS ORIGIN for remote BIT web on Login

Add CORS ORIGIN headers on other existing features

refactor to staging remote urls

remove travis yml

refactor config to include both upstream and fork BIT web url

revert dotenv since gh action use different method for secret

refactor config

update config
  • Loading branch information
mtreacy002 committed Jul 6, 2021
1 parent 2c888bf commit dcbc0c9
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Basic workflow for Actions

name: Build and Deploy to GitHub static pages
# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [ develop ]
branches: [ develop, bit-heroku-url ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -30,7 +30,7 @@ jobs:
run: |
npm install
npm run build
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
Expand Down
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export const BASE_API = process.env.REACT_APP_BASE_API ? process.env.REACT_APP_BASE_API : "http://localhost:5000"
// export const BASE_API = process.env.REACT_APP_BASE_API ? process.env.REACT_APP_BASE_API : "http://localhost:5000"
export const BASE_API = process.env.REACT_APP_BASE_API ? process.env.REACT_APP_BASE_API : "https://bridge-in-tech-backend.herokuapp.com/"
// export const CORS_ORIGIN = process.env.REACT_APP_CORS_ORIGIN ? process.env.REACT_APP_CORS_ORIGIN : "https://anitab-org.github.io"
export const CORS_ORIGIN = process.env.REACT_APP_CORS_ORIGIN ? process.env.REACT_APP_CORS_ORIGIN : "https://mtreacy002.github.io"
// export const CORS_ORIGIN = process.env.REACT_APP_CORS_ORIGIN ? process.env.REACT_APP_CORS_ORIGIN : "http://localhost:3000"

4 changes: 3 additions & 1 deletion src/login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useContext } from "react";
import "./Login.css";
import { Redirect, Link } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import {BASE_API} from "../config";
import {BASE_API, CORS_ORIGIN} from "../config";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";

export default function Login() {
Expand All @@ -23,6 +23,7 @@ export default function Login() {
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand All @@ -37,6 +38,7 @@ export default function Login() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
}
}).then(async response => {
let userData = await response.json();
Expand Down
3 changes: 2 additions & 1 deletion src/members/Members.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useContext, useEffect } from "react";
import { Table } from "react-bootstrap";
import { Link } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";
import "./Member.css";

Expand All @@ -19,6 +19,7 @@ export default function Members() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/myorganization/EditOrganization.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect, useContext} from "react";
import { Link } from "react-router-dom";
import {AuthContext} from "../AuthContext";
import {BASE_API} from "../config";
import {BASE_API, CORS_ORIGIN} from "../config";
import "./EditOrganization.css";
import {SERVICE_UNAVAILABLE_ERROR} from "../messages";
import { ORGANIZATION_STATUS} from "../enums";
Expand All @@ -22,6 +22,7 @@ export default function EditOrganization() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down Expand Up @@ -53,6 +54,7 @@ export default function EditOrganization() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down
3 changes: 2 additions & 1 deletion src/myorganization/EditProgram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
HIGHEST_EDUCATION,
YEARS_OF_EXPERIENCE
} from "../backgrounds";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";
import { PROGRAM_STATUS, CONTACT_TYPE, ZONE } from "../enums";
import { AuthContext } from "../AuthContext";
Expand Down Expand Up @@ -66,6 +66,7 @@ export default function EditProgram() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down
3 changes: 2 additions & 1 deletion src/myorganization/EditPrograms.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useContext } from "react";
import { Table } from "react-bootstrap";
import { Link, useLocation } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import "./EditOrganization.css";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";

Expand All @@ -22,6 +22,7 @@ export default function EditPrograms() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/myspace/AdditionalInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useContext } from "react";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { AuthContext } from "../AuthContext";
import "./MySpace.css";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";
Expand All @@ -21,6 +21,7 @@ export default function AdditionalInfo() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down Expand Up @@ -59,6 +60,7 @@ export default function AdditionalInfo() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down
4 changes: 3 additions & 1 deletion src/myspace/PersonalBackground.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useContext } from "react";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { AuthContext } from "../AuthContext";
import "./MySpace.css";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";
Expand Down Expand Up @@ -28,6 +28,7 @@ export default function PersonalBackground() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down Expand Up @@ -64,6 +65,7 @@ export default function PersonalBackground() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down
4 changes: 3 additions & 1 deletion src/myspace/PersonalDetails.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useContext } from "react";
import { AuthContext } from "../AuthContext";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import "./MySpace.css";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";

Expand All @@ -22,6 +22,7 @@ export default function PersonalDetails() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down Expand Up @@ -57,6 +58,7 @@ export default function PersonalDetails() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down
3 changes: 2 additions & 1 deletion src/organizations/Organizations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useContext, useEffect } from "react";
import { Table } from "react-bootstrap";
import { Link } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";
import "./Organization.css";

Expand All @@ -19,6 +19,7 @@ export default function Organizations() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down
3 changes: 2 additions & 1 deletion src/organizations/Programs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState, useContext} from "react";
import { Table } from "react-bootstrap";
import { Link, useLocation } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import { BASE_API } from "../config";
import { BASE_API, CORS_ORIGIN } from "../config";
import { SERVICE_UNAVAILABLE_ERROR } from "../messages";


Expand All @@ -21,6 +21,7 @@ export default function Programs() {
"Authorization": `Bearer ${access_token}`,
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
};

Expand Down
3 changes: 2 additions & 1 deletion src/register/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useContext } from "react";
import "./Register.css";
import { Redirect, Link } from "react-router-dom";
import { AuthContext } from "../AuthContext";
import {BASE_API} from "../config";
import {BASE_API, CORS_ORIGIN} from "../config";
import {SERVICE_UNAVAILABLE_ERROR} from "../messages";
import TermsAndPrivacyPolicyModal from "./TermsAndPrivacyPolicyModal";

Expand Down Expand Up @@ -36,6 +36,7 @@ export default function Register() {
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": {CORS_ORIGIN}
},
body: JSON.stringify(payload)
};
Expand Down

0 comments on commit dcbc0c9

Please sign in to comment.