Files
Ethan Shen d9332c2bae feat(route): add 纪妖 (#12824)
* feat(route): add 纪妖

* fix: use wordpress restapi

* update lib/v2/cbaigui/index.js
---------
2023-07-19 23:35:48 +08:00

19 lines
453 B
JavaScript

const got = require('@/utils/got');
const rootUrl = 'https://cbaigui.com';
const apiSlug = 'wp-json/wp/v2';
const GetFilterId = async (type, name) => {
const filterApiUrl = new URL(`${apiSlug}/${type}?search=${name}`, rootUrl).href;
const { data: filterResponse } = await got(filterApiUrl);
return filterResponse.filter((f) => f.name === name).pop()?.id ?? undefined;
};
module.exports = {
rootUrl,
apiSlug,
GetFilterId,
};