File tree 4 files changed +12
-9
lines changed
4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ useSeoMeta({
3
3
title: ' unsight.dev' ,
4
4
description: ' Detect duplicate GitHub issues, areas of concern and more across related repositories' ,
5
5
})
6
+
7
+ const { data : repos } = useRepos ()
6
8
</script >
7
9
8
10
<template >
@@ -37,6 +39,8 @@ useSeoMeta({
37
39
>
38
40
@danielroe.dev
39
41
</a >
42
+ · ;
43
+ {{ repos.length }} repos
40
44
</footer >
41
45
</div >
42
46
</template >
Original file line number Diff line number Diff line change
1
+ export const useRepos = ( ) => useFetch ( '/api/repos' , {
2
+ baseURL : useRuntimeConfig ( ) . public . remote ,
3
+ getCachedData : ( key , nuxtApp ) => nuxtApp . payload . data [ key ] || nuxtApp . static . data [ key ] ,
4
+ default : ( ) => [ ] ,
5
+ } )
Original file line number Diff line number Diff line change 2
2
import hexRgb from ' hex-rgb'
3
3
import rgbToHSL from ' rgb-to-hsl'
4
4
5
- const { data : allowedRepos } = useFetch (' /api/repos' , {
6
- baseURL: useRuntimeConfig ().public .remote ,
7
- default : () => [],
8
- })
5
+ const { data : allowedRepos } = useRepos ()
9
6
10
7
const route = useRoute (' owner-repo' )
11
8
const selectedRepo = computed (() => route .params .owner && route .params .repo ? ` ${route .params .owner }/${route .params .repo } ` : ' nuxt/nuxt' )
@@ -27,7 +24,7 @@ onMounted(async () => {
27
24
})
28
25
29
26
function navigateToRepo(event : Event ) {
30
- const [owner, repo] = (event .target as HTMLSelectElement ).value .split (' /' )
27
+ const [owner, repo] = (event .target as HTMLSelectElement ).value .split (' /' ) as [ string , string ]
31
28
return navigateTo ({
32
29
name: ' owner-repo' ,
33
30
params: { owner , repo },
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
const config = useRuntimeConfig ()
3
3
4
- const { data : allowedRepos, refresh } = useFetch (' /api/repos' , {
5
- baseURL: config .public .remote ,
6
- default : () => [],
7
- })
4
+ const { data : allowedRepos, refresh } = useRepos ()
8
5
9
6
const installationURL = ` https://github.com/apps/${config .public .github .appSlug }/installations/new `
10
7
You can’t perform that action at this time.
0 commit comments