Skip to content

Commit

Permalink
fixed axios
Browse files Browse the repository at this point in the history
  • Loading branch information
Moneexa committed Dec 2, 2023
1 parent f6ba8f8 commit 1c019e9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
4 changes: 0 additions & 4 deletions cypress/e2e/adrManagerTest/apiUrlConfig/config.js

This file was deleted.

2 changes: 2 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import "./commands";
// cypress/support/index.js
import "@cypress/code-coverage/support";


export const TEST_BASE_URL = "http://localhost:8000/adr-manager/#/manager";
export const GRAPHQL_URL = "https://api.github.com/graphql"
export const REST_REPO_URL = "**/repos/**"
export const REST_BRANCH_URL = "**/repos/**/branches/**"
export const REST_COMMIT_URL = "**/repos/**/git/commits?**"

2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>

<script>
import { setHeaders } from "./plugins/apiConfig/config"
setHeaders()
export default {
name: "App",
Expand Down
3 changes: 0 additions & 3 deletions src/components/ConnectToGitHubButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<script>
import { signInWithPopup, GithubAuthProvider } from "firebase/auth";
import { auth, GithubProvider } from "../plugins/firebase/client";
import axios from "axios";
import { getHeaders } from "../plugins/apiConfig/config";
export default {
name: "connectGitHub",
components: {},
Expand All @@ -27,7 +25,6 @@ export default {
if (localStorage.getItem("authId") === null) {
this.signInWithGithub()
} else {
axios.defaults.headers.common['Authorization'] = getHeaders().Authorization;
this.$router.push({
name: "Editor",
params: { id: this.user }
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/apiConfig/config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import axios from "axios"
const BASE_URL_USER = "https://api.github.com/user"
const BASE_URL_REPO = "https://api.github.com/repos"

const getHeaders = () => {
return {
Authorization: `Bearer ${localStorage?.getItem("authId")}`
}
}


export { BASE_URL_REPO, BASE_URL_USER, getHeaders }
const setHeaders = () => {
axios.defaults.headers.common['Authorization'] = getHeaders().Authorization;
}
export { BASE_URL_REPO, BASE_URL_USER, setHeaders }

0 comments on commit 1c019e9

Please sign in to comment.