mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-09 20:03:09 +02:00
test: try using if statement
This commit is contained in:
parent
77754cc3d8
commit
3b2bf0dc35
1 changed files with 10 additions and 7 deletions
|
@ -628,16 +628,19 @@ export default class Misskey implements MegalodonInterface {
|
|||
}
|
||||
}
|
||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
|
||||
if ((res.data as any)["error"]) {
|
||||
return Object.assign(res, {
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [],
|
||||
hashtags: [],
|
||||
}
|
||||
})
|
||||
}
|
||||
return Object.assign(res, {
|
||||
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl))
|
||||
})
|
||||
}).catch(() => ({
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [],
|
||||
hashtags: [],
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
// ======================================
|
||||
|
|
Loading…
Reference in a new issue