Remove unused getter
This commit is contained in:
parent
bff2d1becb
commit
b64c14b067
1 changed files with 0 additions and 63 deletions
|
|
@ -1,13 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
const Common = require('shock-common')
|
|
||||||
|
|
||||||
const Key = require('../key')
|
const Key = require('../key')
|
||||||
const Utils = require('../utils')
|
const Utils = require('../utils')
|
||||||
|
|
||||||
const { size } = require('lodash')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} pub
|
* @param {string} pub
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<string>}
|
||||||
|
|
@ -26,63 +23,3 @@ exports.currentOrderAddress = async pub => {
|
||||||
|
|
||||||
return currAddr
|
return currAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<any>}
|
|
||||||
*/
|
|
||||||
//@returns {Promise<Common.SchemaTypes.User>}
|
|
||||||
const getMyUser = async () => {
|
|
||||||
const oldProfile = await Utils.tryAndWait(
|
|
||||||
(_, user) => new Promise(res => user.get(Key.PROFILE).load(res)),
|
|
||||||
v => {
|
|
||||||
if (typeof v !== 'object') {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v === null) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// load sometimes returns an empty set on the first try
|
|
||||||
return size(v) === 0
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const bio = await Utils.tryAndWait(
|
|
||||||
(_, user) => user.get(Key.BIO).then(),
|
|
||||||
v => typeof v !== 'string'
|
|
||||||
)
|
|
||||||
|
|
||||||
const lastSeenApp = await Utils.tryAndWait(
|
|
||||||
(_, user) => user.get(Key.LAST_SEEN_APP).then(),
|
|
||||||
v => typeof v !== 'number'
|
|
||||||
)
|
|
||||||
|
|
||||||
const lastSeenNode = await Utils.tryAndWait(
|
|
||||||
(_, user) => user.get(Key.LAST_SEEN_NODE).then(),
|
|
||||||
v => typeof v !== 'number'
|
|
||||||
)
|
|
||||||
|
|
||||||
const publicKey = await Utils.tryAndWait(
|
|
||||||
(_, user) => Promise.resolve(user.is && user.is.pub),
|
|
||||||
v => typeof v !== 'string'
|
|
||||||
)
|
|
||||||
//@ts-ignore
|
|
||||||
/** @type {Common.SchemaTypes.User} */
|
|
||||||
const u = {
|
|
||||||
avatar: oldProfile.avatar,
|
|
||||||
// @ts-ignore
|
|
||||||
bio,
|
|
||||||
displayName: oldProfile.displayName,
|
|
||||||
// @ts-ignore
|
|
||||||
lastSeenApp,
|
|
||||||
// @ts-ignore
|
|
||||||
lastSeenNode,
|
|
||||||
// @ts-ignore
|
|
||||||
publicKey
|
|
||||||
}
|
|
||||||
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.getMyUser = getMyUser
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue