Skip to content

Commit

Permalink
feat: create util function for managing axios header
Browse files Browse the repository at this point in the history
  • Loading branch information
timepresent95 committed Aug 3, 2024
1 parent 39222da commit 2977fae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utils/headers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import axiosInstance from '@/api/axios';

function setHeader(key: string, value: string) {
axiosInstance.defaults.headers.common[key] = value;
}

function removeHeader(key: string) {
if (!axiosInstance.defaults.headers.common[key]) {
return;
}

delete axiosInstance.defaults.headers.common[key];
}

export {setHeader, removeHeader};
2 changes: 2 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './encryptStorage';
export * from './headers';

0 comments on commit 2977fae

Please sign in to comment.