实现缓存功能
This commit is contained in:
@@ -5,7 +5,12 @@ export async function search (keyword:string, page:number) {
|
||||
url.searchParams.append('q', keyword)
|
||||
url.searchParams.append('page', page.toString())
|
||||
const response = await fetch(url.toString(), { method: 'get' })
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
if (response.status >= 400) {
|
||||
throw new Error(result.message)
|
||||
}
|
||||
|
||||
return result as RepositorySearchResultList
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user