also looking at this
Close unauthenticated /api/requests CRUD, and make the session cookie HttpOnly
#77
11 files
+552
-57
| @@ -22,7 +22,11 @@ defineStore('notifications', () => { | ||
| 22 | 22 | |
| 23 | 23 | async function fetchNotifications(): Promise<void> { |
| 24 | 24 | const authStore = useStore('auth') |
| 25 | if (!authStore.token()) return | |
| 25 | // isAuthenticated(), not token(): the token is in-memory only since the | |
| 26 | // session moved to an HttpOnly cookie, so it is empty after a reload while | |
| 27 | // the session is still valid. Keying off it here meant the bell silently | |
| 28 | // stopped fetching on every hard refresh. | |
| 29 | if (!authStore.isAuthenticated()) return | |
| 26 | 30 | loading.set(true) |
| 27 | 31 | try { |
| 28 | 32 | const res = await authStore.authFetch(`/api/me/notifications?filter=${filter()}&limit=30`) |