fix(badges): check if user is null
This commit is contained in:
parent
863466e48a
commit
a0c2ca7837
1 changed files with 14 additions and 13 deletions
|
|
@ -1,8 +1,7 @@
|
||||||
import { addJSXCallback } from "@lib/api/jsx";
|
import { addJSXCallback } from "@lib/api/jsx";
|
||||||
import { after } from "@lib/api/patcher";
|
import { after } from "@lib/api/patcher";
|
||||||
import { findByName } from "@metro";
|
import { findByName } from "@metro";
|
||||||
import { FC, useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { ImageSourcePropType, ViewStyle } from "react-native";
|
|
||||||
|
|
||||||
import { defineCorePlugin } from "..";
|
import { defineCorePlugin } from "..";
|
||||||
|
|
||||||
|
|
@ -42,19 +41,21 @@ export default defineCorePlugin({
|
||||||
}
|
}
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
badges.forEach((badges, i) => {
|
if (user) {
|
||||||
propHolder[`bunny-${user.userId}-${i}`] = {
|
badges.forEach((badges, i) => {
|
||||||
source: { uri: badges.url },
|
propHolder[`bunny-${user.userId}-${i}`] = {
|
||||||
id: `bunny-${i}`,
|
source: { uri: badges.url },
|
||||||
label: badges.label
|
id: `bunny-${i}`,
|
||||||
};
|
label: badges.label
|
||||||
|
};
|
||||||
|
|
||||||
r.push({
|
r.push({
|
||||||
id: `bunny-${user.userId}-${i}`,
|
id: `bunny-${user.userId}-${i}`,
|
||||||
description: badges.label,
|
description: badges.label,
|
||||||
icon: "2ba85e8026a8614b640c2837bcdfe21b",
|
icon: "_",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue