Skip to content

Commit 6cc780c

Browse files
refactor: change callback name
1 parent 3176d58 commit 6cc780c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/composables/npm/useNpmSearch.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function packumentToSearchResult(
4242
export interface NpmSearchOptions {
4343
/** Number of results to fetch */
4444
size?: number
45-
onSuccess?: (result: { query: string }) => void
45+
onResponse?: (result: { query: string }) => void
4646
}
4747

4848
export const emptySearchResponse = {
@@ -100,7 +100,7 @@ export function useNpmSearch(
100100
size: opts.size ?? 25,
101101
})
102102

103-
opts.onSuccess?.({ query: q })
103+
opts.onResponse?.({ query: q })
104104

105105
if (q !== toValue(query)) {
106106
return emptySearchResponse
@@ -133,7 +133,7 @@ export function useNpmSearch(
133133
}),
134134
])
135135

136-
opts.onSuccess?.({ query: q })
136+
opts.onResponse?.({ query: q })
137137

138138
if (!pkg) {
139139
return emptySearchResponse
@@ -170,7 +170,7 @@ export function useNpmSearch(
170170
60,
171171
)
172172

173-
opts.onSuccess?.({ query: q })
173+
opts.onResponse?.({ query: q })
174174

175175
// If query changed/outdated, return empty search response
176176
if (q !== toValue(query)) {

app/pages/search.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const {
193193
isRateLimited,
194194
} = useNpmSearch(query, () => ({
195195
size: requestedSize.value,
196-
onSuccess: data => {
196+
onResponse: data => {
197197
router.replace({
198198
name: 'search',
199199
query: { ...route.query, q: data.query },

0 commit comments

Comments
 (0)