实现缓存功能

This commit is contained in:
2021-07-26 18:35:38 +08:00
parent 78addb6d96
commit d5a6196d5b
3 changed files with 136 additions and 14 deletions
+5
View File
@@ -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
}