本文整理汇总了TypeScript中@/util/api.GET函数的典型用法代码示例。如果您正苦于以下问题:TypeScript GET函数的具体用法?TypeScript GET怎么用?TypeScript GET使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fetchItems
import { ActionTree } from 'vuex'
import { MenuState } from './types'
import { RootState } from '../types'
import { GET } from '@/util/api'
const actions: ActionTree<MenuState, RootState> = {
async fetchItems({ commit }, params) {
const { category, page } = params
const response = await GET(category, {
_limit: 9,
_page: page,
})
commit('FETCH_ITEMS', response)
},
}
export default actions
示例2: fetchItem
import { ActionTree } from 'vuex'
import { EventState } from './types'
import { RootState } from '../types'
import { GET } from '@/util/api'
const actions: ActionTree<EventState, RootState> = {
async fetchItem({ commit }, { type, id }) {
const {
data: { event, ...rest },
} = await GET(`event_detail/${id}`, {
_expand: 'event',
})
commit('FETCH_ITEM', {
...rest,
...event,
})
const betweenQuery = {
_sort: 'id',
_limit: 1,
id_ne: id,
is_new: type === 'progress',
}
const responseNav = await Promise.all([
GET('events', {
...betweenQuery,
id_lte: id,
_order: 'desc',
}),