Skip to content

Commit 260cf80

Browse files
authored
Fixed not logged in (#2850)
1 parent 02a727b commit 260cf80

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index

save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/index/IndexViewUserInfo.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ val indexViewInfo: FC<UserInfoAwareProps> = FC { props ->
4040
val (notificationForDeletion, setNotificationForDeletion) = useState<NotificationDto?>(null)
4141

4242
useRequest {
43-
val newNotifications = get(
44-
url = "$apiUrl/notifications/get-all-by-user",
45-
headers = jsonHeaders,
46-
loadingHandler = ::noopLoadingHandler,
47-
).unsafeMap {
48-
it.decodeFromJsonString<List<NotificationDto>>()
49-
}
43+
props.userInfo?.let {
44+
val newNotifications = get(
45+
url = "$apiUrl/notifications/get-all-by-user",
46+
headers = jsonHeaders,
47+
loadingHandler = ::noopLoadingHandler,
48+
).unsafeMap {
49+
it.decodeFromJsonString<List<NotificationDto>>()
50+
}
5051

51-
setNotifications(newNotifications)
52+
setNotifications(newNotifications)
53+
}
5254
}
5355

5456
useRequest(arrayOf(notificationForDeletion)) {

0 commit comments

Comments
 (0)