本文整理汇总了TypeScript中API.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getHomeData
async getHomeData() {
const today = moment().format('YYYY-MM-DD')
const tomorrow = moment()
.add(1, 'days')
.format('YYYY-MM-DD')
const response = await get(`matmeny?from=${today}&to=${tomorrow}`)
const data = (await response.json()) as MatmenyDay[]
return {
today: {
date: today,
data: data.find(item => item.day === today),
},
tomorrow: {
date: tomorrow,
data: data.find(item => item.day === tomorrow),
},
}
}
示例2: getList
async getList() {
const response = await get('dugnaden/old')
return (await response.json()) as DugnadDay[]
}
示例3: getUser
async getUser(username: string) {
const response = await get('user/' + encodeURIComponent(username))
return (await response.json()) as UserDetailsFull
}
示例4: getUserList
async getUserList() {
const response = await get('user')
return await response.json()
}
示例5: getNext
async getNext() {
const response = await get('arrplan/next?count=6')
return (await response.json()) as EventItem[]
}
示例6: getList
async getList() {
const response = await get('arrplan?invalidate=1')
return (await response.json()) as EventItem[]
}
示例7: getLastList
async getLastList() {
const response = await get('printer/last')
return (await response.json()) as LastPrintItem[]
}
示例8: getGroup
async getGroup(groupName: string) {
const response = await get('group/' + encodeURIComponent(groupName))
return (await response.json()) as GroupDetail
}
示例9: getGroupList
async getGroupList() {
const response = await get('group')
return (await response.json()) as Group[]
}