File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
apps/web/src/routes/(app) Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { goto } from ' $app/navigation' ;
3
+ import { AUTH_SERVICE } from ' $lib/auth/authService.svelte' ;
3
4
import DashboardLayout from ' $lib/components/dashboard/DashboardLayout.svelte' ;
5
+ import { USER_SERVICE } from ' $lib/user/userService' ;
4
6
import { inject } from ' @gitbutler/shared/context' ;
5
7
import { isFound } from ' @gitbutler/shared/network/loadable' ;
6
8
import { getRecentlyPushedProjects } from ' @gitbutler/shared/organizations/projectsPreview.svelte' ;
7
9
import { WEB_ROUTES_SERVICE } from ' @gitbutler/shared/routing/webRoutes.svelte' ;
8
10
import { Button } from ' @gitbutler/ui' ;
9
11
12
+ const authService = inject (AUTH_SERVICE );
13
+ const persistedToken = authService .token ;
14
+
10
15
const routes = inject (WEB_ROUTES_SERVICE );
16
+ const userService = inject (USER_SERVICE );
17
+ const user = userService .user ;
18
+
19
+ const loggedIn = $derived ($user !== undefined );
11
20
const recentProjects = getRecentlyPushedProjects ();
12
21
let hasRecentProjects = $state (false );
13
22
25
34
}
26
35
}
27
36
});
37
+
38
+ $effect (() => {
39
+ if (! loggedIn && persistedToken .current ) {
40
+ // Clear any stale tokens if the user is not logged in
41
+ authService .clearToken ();
42
+ }
43
+ });
28
44
</script >
29
45
30
- {#if hasRecentProjects }
46
+ {#if ! loggedIn }
47
+ <p >Loading...</p >
48
+ {:else if hasRecentProjects }
31
49
<DashboardLayout >
32
50
<p >You have no recent projects!</p >
33
51
</DashboardLayout >
You can’t perform that action at this time.
0 commit comments