|
@@ -1,5 +1,3 @@
|
|
-import request, { ErrorResponse } from '@annybs/request-js'
|
|
|
|
-
|
|
|
|
export interface Skill {
|
|
export interface Skill {
|
|
name: string
|
|
name: string
|
|
link?: string
|
|
link?: string
|
|
@@ -53,11 +51,14 @@ export default function Skills(): SkillsState {
|
|
this.currentTag = tag
|
|
this.currentTag = tag
|
|
|
|
|
|
try {
|
|
try {
|
|
- const res = await request.get(url)
|
|
|
|
- this.skills = (res.json as Skill[]).sort((a, b) => a.name.localeCompare(b.name))
|
|
|
|
|
|
+ const res = await fetch(url)
|
|
|
|
+ if (res.status !== 200) throw new Error('not OK')
|
|
|
|
+
|
|
|
|
+ const data = await res.json() as Skill[]
|
|
|
|
+ this.skills = (data).sort((a, b) => a.name.localeCompare(b.name))
|
|
updateVisibleSkills.apply(this)
|
|
updateVisibleSkills.apply(this)
|
|
} catch (err) {
|
|
} catch (err) {
|
|
- const e = err as ErrorResponse
|
|
|
|
|
|
+ const e = err as Error
|
|
console.error(e.name, e.message)
|
|
console.error(e.name, e.message)
|
|
}
|
|
}
|
|
},
|
|
},
|