wr cookie 외

This commit is contained in:
ljpark
2025-10-17 17:29:26 +09:00
parent 0f9d13a80a
commit 89bb35bb3c
17 changed files with 117 additions and 154 deletions
-24
View File
@@ -1,8 +1,4 @@
//8880
import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config";
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "../config/";
import { getCookie } from "@common/components/lib/cookie";
export const fetchType = {
COMMON: "common",
@@ -21,14 +17,10 @@ export const getFetch = async (type: string, url: string) => {
? ""
: DEV_URL_WR;
const apiUrl = div + url;
const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME);
const response = await fetch(apiUrl, {
method: "GET",
headers: {
accept: "application/json",
[AUTH_USER_ID]: tokenId ?? "",
[CLAIM_NAME]: Authorization ?? "",
},
});
@@ -72,15 +64,11 @@ export const getFetchWithCount = async (type: string, url: string) => {
? ""
: DEV_URL_WR;
const apiUrl = div + url;
const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME);
const response = await fetch(apiUrl, {
method: "GET",
headers: {
accept: "application/json",
[AUTH_USER_ID]: tokenId ?? "",
[CLAIM_NAME]: Authorization ?? "",
},
});
@@ -117,16 +105,12 @@ export const getFetchWithCount = async (type: string, url: string) => {
export const postFectch = async (url: string, params: any, type?: string) => {
const div = type === fetchType.COMMON ? DEV_URL_FO : DEV_URL_WR;
const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME);
const apiUrl = div + url;
const response = await fetch(apiUrl, {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "application/json",
[AUTH_USER_ID]: tokenId ?? "",
[CLAIM_NAME]: Authorization ?? "",
},
body: JSON.stringify(params),
});
@@ -146,15 +130,11 @@ export const putFectch = async (url: string, params: any, type?: string) => {
? ""
: DEV_URL_WR;
const apiUrl = div + url;
const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME);
const response = await fetch(apiUrl, {
method: "PUT",
headers: {
"Content-Type": "application/json",
[AUTH_USER_ID]: tokenId ?? "",
[CLAIM_NAME]: Authorization ?? "",
},
body: JSON.stringify(params),
});
@@ -178,15 +158,11 @@ export const deleteFectch = async (
? ""
: DEV_URL_WR;
const apiUrl = div + url;
const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME);
const response = await fetch(apiUrl, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
[AUTH_USER_ID]: tokenId ?? "",
[CLAIM_NAME]: Authorization ?? "",
},
body: params ? JSON.stringify(params) : undefined,
});