Commit f49f97d4 authored by Chunchi Che's avatar Chunchi Che

fix CORS

parent 6be6ef36
Pipeline #27583 passed with stages
in 8 minutes and 9 seconds
...@@ -4,7 +4,7 @@ import { MdproDeck } from "./schema"; ...@@ -4,7 +4,7 @@ import { MdproDeck } from "./schema";
import { mdproHeaders } from "./util"; import { mdproHeaders } from "./util";
const { mdproServer } = useConfig(); const { mdproServer } = useConfig();
const API_PATH = "api/mdpro3/deck"; const API_PATH = "api/mdpro3/deck/list/lite";
export interface PullReq { export interface PullReq {
page?: number; page?: number;
...@@ -15,6 +15,11 @@ export interface PullReq { ...@@ -15,6 +15,11 @@ export interface PullReq {
contributor?: string; contributor?: string;
} }
const defaultPullReq: PullReq = {
page: 1,
size: 20,
};
export interface PullResp { export interface PullResp {
code: number; code: number;
message: string; message: string;
...@@ -27,7 +32,9 @@ export interface PullResp { ...@@ -27,7 +32,9 @@ export interface PullResp {
}; };
} }
export async function pullDecks(req: PullReq): Promise<PullResp | undefined> { export async function pullDecks(
req: PullReq = defaultPullReq,
): Promise<PullResp | undefined> {
const myHeaders = mdproHeaders(); const myHeaders = mdproHeaders();
const params = new URLSearchParams(); const params = new URLSearchParams();
......
...@@ -321,7 +321,7 @@ export const Component: React.FC = () => { ...@@ -321,7 +321,7 @@ export const Component: React.FC = () => {
desc={i18n("WIPDesc")} desc={i18n("WIPDesc")}
icon={null} icon={null}
onClick={async () => { onClick={async () => {
const mdproDecks = await pullDecks({}); const mdproDecks = await pullDecks();
console.log(mdproDecks); console.log(mdproDecks);
}} }}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment