File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,15 +5,15 @@ const route = useRoute();
55const router = useRouter ();
66const search = computed ({
77 get : () => {
8- const text = route .query .text ;
9- return typeof text === " string" ? text : " " ;
8+ const q = route .query .q ;
9+ return typeof q === " string" ? q : " " ;
1010 },
1111 set : (value : string ) => {
1212 const queryText = value .trim ();
1313 router .replace ({
1414 query: {
1515 ... route .query ,
16- text : queryText || undefined ,
16+ q : queryText || undefined ,
1717 },
1818 });
1919 },
4141
4242 try {
4343 const data = await $fetch <{ nodes? : RepoNode [] }>(" /api/repo/search" , {
44- query: { text : query },
44+ query: { q : query },
4545 signal: controller .signal ,
4646 });
4747
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { useBucket } from "../../utils/bucket";
55import { useOctokitApp } from "../../utils/octokit" ;
66
77const querySchema = z . object ( {
8- text : z . string ( ) ,
8+ q : z . string ( ) . optional ( ) ,
99} ) ;
1010
1111const REPO_INDEX_CACHE_KEY = "repo-search:index" ;
@@ -168,15 +168,16 @@ export default defineEventHandler(async (event) => {
168168 const query = await getValidatedQuery ( event , ( data ) =>
169169 querySchema . parse ( data ) ,
170170 ) ;
171+ const searchQuery = ( query . q ?? "" ) . trim ( ) ;
171172
172- if ( ! query . text ) {
173+ if ( ! searchQuery ) {
173174 return { nodes : [ ] } ;
174175 }
175176
176177 const { repos, cacheStatus } = await getIndexedRepos ( event ) ;
177178 setResponseHeader ( event , "x-repo-index-cache" , cacheStatus ) ;
178179
179180 return {
180- nodes : findMatches ( repos , query . text ) ,
181+ nodes : findMatches ( repos , searchQuery ) ,
181182 } ;
182183} ) ;
You can’t perform that action at this time.
0 commit comments