simplify
This commit is contained in:
parent
b4a24ce7fc
commit
61952b17f4
1 changed files with 16 additions and 16 deletions
|
|
@ -22,10 +22,6 @@ export const writeCoordinate = async (coordID, data) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const gunNode = getUser()
|
|
||||||
.get(Key.COORDINATES)
|
|
||||||
.get(coordID)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because there are optional properties, typescript can also allow them
|
* Because there are optional properties, typescript can also allow them
|
||||||
* to be specified but with a value of `undefined`. Filter out these.
|
* 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())
|
return mySEA.encrypt(v, getMySecret())
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
gunNode.put(encData, ack => {
|
|
||||||
if (ack.err && typeof ack.err !== 'number') {
|
getUser()
|
||||||
Logger.info(
|
.get(Key.COORDINATES)
|
||||||
`Error writting corrdinate, coordinate id: ${coordID}, data: ${JSON.stringify(
|
.get(coordID)
|
||||||
data,
|
.put(encData, ack => {
|
||||||
null,
|
if (ack.err && typeof ack.err !== 'number') {
|
||||||
2
|
Logger.info(
|
||||||
)}`
|
`Error writting corrdinate, coordinate id: ${coordID}, data: ${JSON.stringify(
|
||||||
)
|
data,
|
||||||
Logger.error(ack.err)
|
null,
|
||||||
}
|
2
|
||||||
})
|
)}`
|
||||||
|
)
|
||||||
|
Logger.error(ack.err)
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.info(
|
Logger.info(
|
||||||
`Error writing coordinate, coordinate id: ${coordID}, data: ${JSON.stringify(
|
`Error writing coordinate, coordinate id: ${coordID}, data: ${JSON.stringify(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue