bug fix + use id instead of username for lookup

This commit is contained in:
Daniel
2023-07-19 12:14:52 -04:00
parent 01a8579158
commit 35bece5f49
13 changed files with 24 additions and 29 deletions
+5 -5
View File
@@ -29,16 +29,16 @@ export default async function getUser({
return { response: "This profile is private.", status: 401 };
}
const { password, ...unsensitiveInfo } = user;
const { password, ...lessSensitiveInfo } = user;
const data = isSelf
? // If user is requesting its own data
unsensitiveInfo
lessSensitiveInfo
: {
// If user is requesting someone elses data
id: unsensitiveInfo.id,
name: unsensitiveInfo.name,
username: unsensitiveInfo.username,
id: lessSensitiveInfo.id,
name: lessSensitiveInfo.name,
username: lessSensitiveInfo.username,
};
return { response: data || null, status: 200 };