[st] - 입력단 메뉴 작업중
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export { client } from "./client";
|
||||
export { withAuthHeader } from "./with-auth-header";
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { AxiosRequestConfig } from "axios";
|
||||
|
||||
import { getToken } from "@/entities/auth/lib/token-manager";
|
||||
import { CLAIM_NAME } from "@/shared/config";
|
||||
|
||||
export function withAuthHeader<T extends AxiosRequestConfig>(config: T = {} as T): T {
|
||||
const authorization = getToken(CLAIM_NAME);
|
||||
if (!authorization) return config;
|
||||
return {
|
||||
...config,
|
||||
headers: {
|
||||
...config.headers,
|
||||
[CLAIM_NAME]: authorization,
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user