From 2568508ff2675ef8a4c7812b819b3ca675ed065f Mon Sep 17 00:00:00 2001 From: JjungminLee Date: Thu, 22 Feb 2024 06:20:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EB=B0=B1=EC=97=94=EB=93=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Logger.ts | 3 ++- src/apis/postLog.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Logger.ts b/src/Logger.ts index c09c27f..7b10f76 100644 --- a/src/Logger.ts +++ b/src/Logger.ts @@ -95,6 +95,7 @@ window.addEventListener('unload', async (event) => { const logList: any[] = JSON.parse(localStorage.getItem('yls-web') as string) || []; - // const res = await postLog(logList); + const res = await postLog(logList); + console.log(res); SetLocalStorageClear(); }); diff --git a/src/apis/postLog.ts b/src/apis/postLog.ts index 31bd9a2..5c05264 100644 --- a/src/apis/postLog.ts +++ b/src/apis/postLog.ts @@ -1,6 +1,6 @@ import customedAxios from './customedAxios'; -export const postLog = async () => { - const res = await customedAxios.put(''); +export const postLog = async (data: any) => { + const res = await customedAxios.put('/log/list', data); return res.data; }; From 7ff30868e4a81109eff3b457cc40078305bd4b3e Mon Sep 17 00:00:00 2001 From: JjungminLee Date: Fri, 23 Feb 2024 16:52:21 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20console.log=EC=82=AD=EC=A0=9C=20+=20?= =?UTF-8?q?any=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Logger.ts | 7 +++---- src/apis/postLog.ts | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Logger.ts b/src/Logger.ts index 7b10f76..ab15452 100644 --- a/src/Logger.ts +++ b/src/Logger.ts @@ -1,6 +1,7 @@ import { SetLocalStorage, SetLocalStorageClear } from './SetLocalStorage'; -import { LogPayloadParams, ServiceNameType } from './types/LogType'; +import { LogPayloadParams, LogType, ServiceNameType } from './types/LogType'; import CryptoJS from 'crypto-js'; +import { postLog } from './apis/postLog'; const createRandomId = () => { let randomId = ''; @@ -93,9 +94,7 @@ export const Logger = ({ userId, serviceName, name, message, path, tags }: LogPa window.addEventListener('unload', async (event) => { event.preventDefault(); - const logList: any[] = JSON.parse(localStorage.getItem('yls-web') as string) || []; - + const logList: LogType[] = JSON.parse(localStorage.getItem('yls-web') as string) || []; const res = await postLog(logList); - console.log(res); SetLocalStorageClear(); }); diff --git a/src/apis/postLog.ts b/src/apis/postLog.ts index 5c05264..5092da0 100644 --- a/src/apis/postLog.ts +++ b/src/apis/postLog.ts @@ -1,6 +1,7 @@ +import { LogType } from '../types/LogType'; import customedAxios from './customedAxios'; -export const postLog = async (data: any) => { +export const postLog = async (data: LogType[]) => { const res = await customedAxios.put('/log/list', data); return res.data; };