From b56b182357761429e4744de254a45937cfcce07d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 15 Sep 2024 08:06:15 +0900 Subject: [PATCH] [Update] Add some color on console.log for preventing mix up with code 348. and show result data when received invalid endpoint that when receive route is not ready to implement yet. --- src-ui/logics/useReceiveRoutes.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index cde18f2e..acc543ba 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -123,11 +123,11 @@ export const useReceiveRoutes = () => { switch (parsed_data.status) { case 200: const route = routes[parsed_data.endpoint]; - (route) ? route(parsed_data.result) : console.error(`Invalid endpoint: ${parsed_data.endpoint}`); + (route) ? route(parsed_data.result) : console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); break; case 348: - console.log("from backend:", parsed_data); + console.log(`from backend: %c ${JSON.stringify(parsed_data)}`, style_348); break; default: @@ -137,4 +137,8 @@ export const useReceiveRoutes = () => { }; return { receiveRoutes }; -}; \ No newline at end of file +}; + +const style_348 = [ + "color: gray", +].join(";"); \ No newline at end of file