File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import AppContent from './components/AppContent.vue'
3
3
import AppSidebar from ' ./components/AppSidebar.vue'
4
4
import HomePage from ' ./pages/HomePage.vue'
5
5
import SettingsPage from ' ./pages/SettingsPage.vue'
6
- import { Page } from ' ./constants'
6
+ import { FETCH_INTERVAL_DURATION , Page } from ' ./constants'
7
7
import { useStore } from ' ./stores/store'
8
8
import LandingPage from ' ./pages/LandingPage.vue'
9
+ import { useInterval } from ' ./composables/useInterval'
10
+ import { AppStorage } from ' ./storage'
9
11
10
12
const store = useStore ()
13
+
14
+ useInterval (() => {
15
+ if (AppStorage .get (' accessToken' ) && AppStorage .get (' user' ))
16
+ store .fetchNotifications ()
17
+ }, FETCH_INTERVAL_DURATION )
11
18
</script >
12
19
13
20
<template >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Icons } from './components/Icons'
2
2
3
3
export const SERVER_PORT = 23846
4
4
export const REPO_LINK = 'https://github.com/Gitification-App/gitification'
5
+ export const FETCH_INTERVAL_DURATION = 60000
5
6
6
7
export enum Page {
7
8
Settings = 'Settings' ,
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ app.use(pinia)
24
24
const store = useStore ( pinia )
25
25
const token = AppStorage . get ( 'accessToken' )
26
26
const user = AppStorage . get ( 'user' )
27
+
27
28
AppStorage . set ( 'openAtStartup' , await isAutostartEnabled ( ) )
28
29
29
30
if ( token && user )
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ import AppButton from '../components/AppButton.vue'
20
20
21
21
const store = useStore ()
22
22
23
- store . fetchNotifications (store .pageFrom === Page .Landing || store .notifications . length === 0 )
24
- useInterval ( store .fetchNotifications , 60000 )
23
+ if (store .pageFrom === Page .Landing || store .pageFrom == null )
24
+ store .fetchNotifications ( true )
25
25
26
26
function handleNotificationClick(notification : Thread ) {
27
27
const url = toGithubWebURL ({ notification , userId: AppStorage .get (' user' )! .id })
You can’t perform that action at this time.
0 commit comments