本文整理匯總了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',
}),