Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: Add BIT backend heroku url #267

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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}
Copy link
Member

@epicadk epicadk Jul 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the browser not automatically add these? I have no clue about front end I always thought the browser would auto generate these in a "pre-flight" request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epicadk , yeah, unfortunately it did not. Before I added this, the api calls received error stating No Access-Control-Allow-Origin header is present... and it was cleared after I added this.

},
body: JSON.stringify(payload)
};
Expand Down