From 2783686e55f71d663dc7a07abc24a19cb9403d18 Mon Sep 17 00:00:00 2001 From: ohamin26 Date: Sat, 7 Jun 2025 21:31:37 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20axios=20=ED=97=A4=EB=8D=94=20device-i?= =?UTF-8?q?d=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/axios.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/api/axios.ts b/src/app/api/axios.ts index 2c75ed4..f73dd62 100644 --- a/src/app/api/axios.ts +++ b/src/app/api/axios.ts @@ -1,5 +1,6 @@ import axios from "axios"; import nookies from "nookies"; +import { v4 as uuidv4 } from "uuid"; export const instance = axios.create({ baseURL: process.env.NEXT_PUBLIC_JUULABEL_API_URL, @@ -13,9 +14,14 @@ instance.interceptors.request.use( if (typeof window !== "undefined") { const cookies = nookies.get(); const csrftoken = cookies.csrfToken; + const deviceId = localStorage.getItem("device-id") || uuidv4(); + if (!localStorage.getItem("device-id")) { + localStorage.setItem("device-id", deviceId); + } if (csrftoken) { config.headers["X-CSRF-TOKEN"] = csrftoken; + config.headers["Device-Id"] = deviceId; } } return config;