-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #557 from Hongjw030/part3-홍재원-week19
[홍재원] week19
- Loading branch information
Showing
131 changed files
with
2,168 additions
and
1,929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: delete branch on close pr | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: delete branch | ||
uses: SvanBoxel/delete-merged-branch@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import axios from "axios"; | ||
import { getCookie, setCookie } from "@/utils/manageCookie"; | ||
import { getNewToken } from "./getAuthApi"; | ||
|
||
export const axiosInstance = axios.create({ | ||
baseURL: "https://bootcamp-api.codeit.kr/api/linkbrary/v1/", | ||
headers: { | ||
"Content-Type": "application/json", | ||
withCredentials: true, | ||
}, | ||
}); | ||
|
||
axiosInstance.interceptors.request.use( | ||
(config) => { | ||
const accessToken = getCookie("accessToken"); | ||
config.headers["Authorization"] = `Bearer ${accessToken}`; | ||
return config; | ||
}, | ||
(error) => { | ||
return Promise.reject(error); | ||
}, | ||
); | ||
|
||
axios.interceptors.response.use( | ||
(res) => res, | ||
async (error) => { | ||
const { | ||
config, | ||
response: { status }, | ||
} = error; | ||
|
||
if (status === 401) { | ||
const originRequest = config; | ||
const { data } = await getNewToken(); | ||
if (data) { | ||
setCookie("accessToken", data.accessToken); | ||
setCookie("refreshToken", data.refreshToken); | ||
originRequest.headers["Authorization"] = `Bearer ${data.accessToken}`; | ||
return axios(originRequest); | ||
} | ||
} | ||
return Promise.reject(error); | ||
}, | ||
); |
Oops, something went wrong.