added update account functionality
This commit is contained in:
@@ -12,21 +12,19 @@ export default async function (lookupEmail: string, isSelf: boolean) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!user) return { response: "User not found." || null, status: 404 };
|
||||
|
||||
const { password, ...unsensitiveInfo } = user;
|
||||
|
||||
const data = isSelf
|
||||
? {
|
||||
// If user is requesting its data
|
||||
id: user?.id,
|
||||
name: user?.name,
|
||||
email: user?.email,
|
||||
}
|
||||
? // If user is requesting its own data
|
||||
unsensitiveInfo
|
||||
: {
|
||||
// If user is requesting someone elses data
|
||||
id: user?.id,
|
||||
name: user?.name,
|
||||
email: user?.email,
|
||||
id: unsensitiveInfo.id,
|
||||
name: unsensitiveInfo.name,
|
||||
email: unsensitiveInfo.email,
|
||||
};
|
||||
|
||||
const statusCode = user?.id ? 200 : 404;
|
||||
|
||||
return { response: data || null, status: statusCode };
|
||||
return { response: data || null, status: 200 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user