Skip to content

Commit

Permalink
feat:#1 修复默认参数
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 29, 2022
1 parent 509a194 commit 032b723
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/platform/metaweblog/customXmlrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import logUtil from "~/lib/logUtil";
// @ts-ignore
import * as Serializer from 'xmlrpc/lib/serializer'
import { parse } from 'arraybuffer-xml-parser';
console.log(Serializer)

/**
* 自定义xmlrpc的请求与解析,解决apache xmlrpc的扩展问题
Expand Down
4 changes: 3 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import {SERVER_API_CONSTANTS} from "~/lib/constants/serverApiConstants";
const route = useRoute()
const {data} = await useFetch(SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + "?t=" + route.query.t)
const homePostsUrl = route.query.t ? SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + "?t=" + route.query.t :
SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS
const {data} = await useFetch(homePostsUrl)
logUtil.logInfo(SERVER_API_CONSTANTS.SERVER_API_GET_RECENT_POSTS + " data=>", data.value)
definePageMeta({
Expand Down
4 changes: 3 additions & 1 deletion server/api/endpoint/getRecentPosts.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import {API_TYPE_CONSTANTS} from "~/lib/constants";
import {API} from "~/lib/api";
import logUtil from "~/lib/logUtil";

export default defineEventHandler(async (event) => {
const query = useQuery(event)
if (query.t instanceof Array) {
throw new Error("参数类型错误")
}
logUtil.logInfo("query.t", query.t)

const type = query.t || API_TYPE_CONSTANTS.API_TYPE_JVUE
const num = 10
const page = 1
const keyword = ""

const env = useRuntimeConfig()
console.log('Runtime env:', env)
logUtil.logInfo('Runtime env:', env)

const api = new API(type, env)

Expand Down

0 comments on commit 032b723

Please sign in to comment.