Skip to content

Commit

Permalink
fixed axios interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Moneexa committed Dec 2, 2023
1 parent 4f6fa48 commit f6ba8f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/components/ConnectToGitHubButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<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,6 +27,7 @@ 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
4 changes: 1 addition & 3 deletions src/plugins/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import { Repository } from "./classes.js";
import axios from "axios"
import { BASE_URL_REPO, BASE_URL_USER, getHeaders } from "./apiConfig/config.js"
import { BASE_URL_REPO, BASE_URL_USER } from "./apiConfig/config.js"

let repoOwner = "";
let repoName = "";
let branch = "";

axios.defaults.headers.common['Authorization'] = getHeaders().Authorization;

export function setInfosForApi(currRepoOwner, currRepoName, currBranch) {
repoName = currRepoName;
repoOwner = currRepoOwner;
Expand Down

0 comments on commit f6ba8f8

Please sign in to comment.