Fix users without weapon pool having one "null weapon"

This commit is contained in:
Kalle
2023-06-17 21:50:52 +03:00
parent af7c4db4f4
commit 68dac83f4f
2 changed files with 6 additions and 4 deletions

View File

@@ -7,8 +7,10 @@ export function parseDBJsonArray(value: any) {
// If the returned array of JSON objects from DB is empty
// it will be returned as object with all values being null
// this is a workaround for that
return parsed.filter((item: any) => Object.values(item).some(Boolean));
// this is a (hacky) workaround for that
return parsed.filter((item: any) =>
Object.values(item).some((val) => val !== null)
);
}
export function parseDBArray(value: any) {