use Promise.all instead of separate promises

This commit is contained in:
Johann150 2022-12-25 16:07:25 +01:00
parent 114d416de0
commit eea2eb4919
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -22,8 +22,11 @@ export const paramDef = {
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, user) => {
const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
const userDetailed = await Users.findOneByOrFail({ id: user.id });
const [profile, userDetailed] = await Promise.all([
UserProfiles.findOneByOrFail({ userId: user.id }),
Users.findOneByOrFail({ id: user.id }),
]);
if (userDetailed.isDeleted) {
return;
}