feat(backend): standardize logging response

This commit is contained in:
arielherself 2023-11-26 22:25:26 +08:00
parent 1b95222346
commit 14406e6a90
5 changed files with 8 additions and 11 deletions

View File

@ -5,13 +5,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="3c7078e7-6f30-4d92-9696-11496f9e6dff" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/api/click.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/api/handshake.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/click.js" beforeDir="false" afterPath="$PROJECT_DIR$/api/click.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/handshake.js" beforeDir="false" afterPath="$PROJECT_DIR$/api/handshake.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Networking.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/Networking.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/UMap.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/UMap.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -84,7 +80,7 @@
<workItem from="1700814201341" duration="315000" />
<workItem from="1700814808669" duration="47000" />
<workItem from="1700822693197" duration="9493000" />
<workItem from="1701004587189" duration="3052000" />
<workItem from="1701004587189" duration="3578000" />
</task>
<servers />
</component>

View File

@ -2,6 +2,6 @@ const getArgs=(s)=>s.split('@@')
export default function handler(req,res){
res.status(200).json({
log: `Method: click\nArgs: ${getArgs(req.query.query)}`,
log: `Method: click\nArgs: ${getArgs(req.query.query)}\nStatus: test service, nothing done`,
});
}

View File

@ -6,6 +6,7 @@ const __DEBUG__=1,
export default function handler(req,res){
res.status(200).json({
log: 'Method: handshake\nStatus: responded handshake request',
version: __APP_VERSION__,
intro: __APP_INTRO__,
});

View File

@ -7,7 +7,7 @@ export function post(method,args) {
// body: data
});
const response_data = await response.json();
console.log(`Received: ${JSON.stringify(response_data)}`);
console.log(`Request "${method}" finished:\n ${response_data.log.replaceAll('\n','\n ')}`);
return response_data;
};
return ft();

View File

@ -71,10 +71,10 @@ function MapClickHandler({mks}) {
console.info(`Clicking on ${lat} ${lng}`);
mks.current.addMarker(lat, lng);
post('click', [lat, lng]).then((response)=>{
console.log(`Response:\n${response['log']}`)
// TODO
}).catch((e)=>{
console.error(e);
// location.reload();
location.reload();
});
},
// TODO