aboutsummaryrefslogtreecommitdiff
path: root/src/components/notifications/NotificationPill.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-09 17:37:40 -0400
committerIvan Chen <ivan@tagg.id>2021-06-09 17:37:40 -0400
commit93796732be3f5070c0a124d29533396f79736c83 (patch)
tree775b70c4b5b5dabba21009de3459091a5e94d6af /src/components/notifications/NotificationPill.tsx
parent3f42ed623adf591543bb8b738077e9172781ed09 (diff)
Cleanup code
Diffstat (limited to 'src/components/notifications/NotificationPill.tsx')
-rw-r--r--src/components/notifications/NotificationPill.tsx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/components/notifications/NotificationPill.tsx b/src/components/notifications/NotificationPill.tsx
index 7017d2e7..01622a6f 100644
--- a/src/components/notifications/NotificationPill.tsx
+++ b/src/components/notifications/NotificationPill.tsx
@@ -20,7 +20,12 @@ export const NotificationPill: React.FC<NotificationPillProps> = ({
}) => {
const [iconStart, setIconStart] = useState<number[]>([0, -100]);
const [tipStart, setTipStart] = useState<number[]>([0, -100]);
- const [notificationSets, setNotificationSets] = useState({});
+ const [notificationSets, setNotificationSets] = useState<{
+ CMT?: number;
+ FRD_REQ?: number;
+ P_VIEW?: number;
+ MOM_TAG?: number;
+ }>({});
const [timeCount, setTimeCount] = useState<boolean>(false);
const [timeOut, setTimeOut] = useState<boolean>(false);
const iconRef = useRef(null);
@@ -84,7 +89,9 @@ export const NotificationPill: React.FC<NotificationPillProps> = ({
const getCount = async () => {
const data = await getNotificationsUnreadCount();
setTimeout(() => {
- setNotificationSets(data);
+ if (data) {
+ setNotificationSets(data);
+ }
}, 100);
};
@@ -117,14 +124,14 @@ export const NotificationPill: React.FC<NotificationPillProps> = ({
</Text>
</>
)}
- {notificationSets.FR_REQ && (
+ {notificationSets.FRD_REQ && (
<>
<Image
source={require('../../assets/images/pill-icon-2.png')}
style={styles.indicationIcon}
/>
<Text style={styles.text}>
- {numberWithCommas(notificationSets.FR_REQ)}
+ {numberWithCommas(notificationSets.FRD_REQ)}
</Text>
</>
)}