From 61952b17f4b87dc5094dc0042774dae798da8b48 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 22 Feb 2021 08:57:10 -0400 Subject: [PATCH] simplify --- services/coordinates.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/services/coordinates.js b/services/coordinates.js index 79031940..ac212256 100644 --- a/services/coordinates.js +++ b/services/coordinates.js @@ -22,10 +22,6 @@ export const writeCoordinate = async (coordID, data) => { } try { - const gunNode = getUser() - .get(Key.COORDINATES) - .get(coordID) - /** * Because there are optional properties, typescript can also allow them * to be specified but with a value of `undefined`. Filter out these. @@ -38,18 +34,22 @@ export const writeCoordinate = async (coordID, data) => { return mySEA.encrypt(v, getMySecret()) }) ) - gunNode.put(encData, ack => { - if (ack.err && typeof ack.err !== 'number') { - Logger.info( - `Error writting corrdinate, coordinate id: ${coordID}, data: ${JSON.stringify( - data, - null, - 2 - )}` - ) - Logger.error(ack.err) - } - }) + + getUser() + .get(Key.COORDINATES) + .get(coordID) + .put(encData, ack => { + if (ack.err && typeof ack.err !== 'number') { + Logger.info( + `Error writting corrdinate, coordinate id: ${coordID}, data: ${JSON.stringify( + data, + null, + 2 + )}` + ) + Logger.error(ack.err) + } + }) } catch (e) { Logger.info( `Error writing coordinate, coordinate id: ${coordID}, data: ${JSON.stringify(