diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4573cf2e..24f02d1e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ # 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: @@ -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: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8c8ff7f1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - 12.16 -cache: - npm: false -script: - - npm test - - CI=false npm run build diff --git a/src/config.js b/src/config.js index 1691a237..7b0667de 100644 --- a/src/config.js +++ b/src/config.js @@ -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" + diff --git a/src/login/Login.jsx b/src/login/Login.jsx index c74f436b..e4700e7e 100644 --- a/src/login/Login.jsx +++ b/src/login/Login.jsx @@ -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() { @@ -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) }; @@ -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(); diff --git a/src/members/Members.jsx b/src/members/Members.jsx index 7e3830a9..dedab1bb 100644 --- a/src/members/Members.jsx +++ b/src/members/Members.jsx @@ -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"; @@ -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} }, }; diff --git a/src/myorganization/EditOrganization.jsx b/src/myorganization/EditOrganization.jsx index ce0265cd..69917f7a 100644 --- a/src/myorganization/EditOrganization.jsx +++ b/src/myorganization/EditOrganization.jsx @@ -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"; @@ -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} }, }; @@ -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) }; diff --git a/src/myorganization/EditProgram.jsx b/src/myorganization/EditProgram.jsx index 444f6dba..360a36cc 100644 --- a/src/myorganization/EditProgram.jsx +++ b/src/myorganization/EditProgram.jsx @@ -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"; @@ -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) }; diff --git a/src/myorganization/EditPrograms.jsx b/src/myorganization/EditPrograms.jsx index 0eb2ef29..78dfeb96 100644 --- a/src/myorganization/EditPrograms.jsx +++ b/src/myorganization/EditPrograms.jsx @@ -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"; @@ -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} }, }; diff --git a/src/myspace/AdditionalInfo.jsx b/src/myspace/AdditionalInfo.jsx index 06974de5..c1aec809 100644 --- a/src/myspace/AdditionalInfo.jsx +++ b/src/myspace/AdditionalInfo.jsx @@ -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"; @@ -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} }, }; @@ -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) }; diff --git a/src/myspace/PersonalBackground.jsx b/src/myspace/PersonalBackground.jsx index 1aec87a0..af68100a 100644 --- a/src/myspace/PersonalBackground.jsx +++ b/src/myspace/PersonalBackground.jsx @@ -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"; @@ -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} }, }; @@ -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) }; diff --git a/src/myspace/PersonalDetails.jsx b/src/myspace/PersonalDetails.jsx index 2b17398c..0efdc63b 100644 --- a/src/myspace/PersonalDetails.jsx +++ b/src/myspace/PersonalDetails.jsx @@ -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"; @@ -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} }, }; @@ -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) }; diff --git a/src/organizations/Organizations.jsx b/src/organizations/Organizations.jsx index 4487e77e..c2b25b25 100644 --- a/src/organizations/Organizations.jsx +++ b/src/organizations/Organizations.jsx @@ -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"; @@ -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} }, }; diff --git a/src/organizations/Programs.jsx b/src/organizations/Programs.jsx index 1dea2a4b..44e0719e 100644 --- a/src/organizations/Programs.jsx +++ b/src/organizations/Programs.jsx @@ -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"; @@ -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} }, }; diff --git a/src/register/Register.jsx b/src/register/Register.jsx index 36113c76..8bc50bfd 100644 --- a/src/register/Register.jsx +++ b/src/register/Register.jsx @@ -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"; @@ -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) };