File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import lscache from "lscache" ;
2
- import DiscordClient from "./discord" ;
2
+ import DiscordClient , { NamedThing } from "./discord" ;
3
3
4
4
const realmApi = import . meta. env . VITE_APP_REALM_API ;
5
5
@@ -86,7 +86,7 @@ export default class RealmClient {
86
86
} ) ;
87
87
}
88
88
89
- async getSharedGuilds ( ) {
89
+ async getSharedGuilds ( ) : Promise < NamedThing [ ] > {
90
90
return await this . realmApi ( "/auth/shared-guilds" )
91
91
. then ( ( r ) => r . json ( ) )
92
92
. then ( ( d ) => d . guilds ) ;
Original file line number Diff line number Diff line change 2
2
import DiscordAvatar from " @/app/components/discord-avatar.vue" ;
3
3
import { doneLoading } from " @/app/lib/global" ;
4
4
import RealmClient from " @/app/lib/realm" ;
5
+ import lscache from " lscache" ;
5
6
import { inject , onMounted } from " vue" ;
7
+ import { NamedThing } from " ../lib/discord" ;
6
8
7
9
const realm: RealmClient = inject (" realmClient" )! ;
8
- const sharedGuilds = await realm .getSharedGuilds ();
10
+ lscache .setBucket (" requests" );
11
+ let sharedGuilds: NamedThing [] | null = lscache .get (" sharedGuilds" );
12
+
13
+ if (! sharedGuilds ) {
14
+ sharedGuilds = await realm .getSharedGuilds ();
15
+ lscache .set (" sharedGuilds" , sharedGuilds , 30 );
16
+ }
9
17
10
18
onMounted (() => doneLoading ());
11
19
</script >
You can’t perform that action at this time.
0 commit comments