Files
ao3-mirror-ssr/src/stores/api.js
UnknownMp eb5b28249f
All checks were successful
Build / build-and-test (push) Successful in 28s
[Base] 修改 API 接口使得支持 GET 请求参数
2025-05-24 10:33:57 +08:00

21 lines
556 B
JavaScript

import { defineStore } from 'pinia'
import { useApiRequest } from '../composables/apiRequest'
export const useApiStore = defineStore('api', () => {
async function getWork(workId, chapterId) {
const path = chapterId ? `work/${workId}/${chapterId}` : `work/${workId}`
const { execute } = useApiRequest('GET', path)
return await execute()
}
async function workSimpleSearch(keyword, page = 1) {
const { execute } = useApiRequest('GET', 'search/simple', { keyword, page })
return await execute()
}
return {
getWork,
workSimpleSearch
}
})