[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.
This commit is contained in:
Sakamoto Shiina
2024-09-15 08:06:15 +09:00
parent 1424abe44e
commit b56b182357

View File

@@ -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 };
};
};
const style_348 = [
"color: gray",
].join(";");