Commit f86cb502 authored by Chunchi Che's avatar Chunchi Che

fix small

parent 18ab60c3
Pipeline #27779 passed with stages
in 6 minutes and 50 seconds
import { useConfig } from "@/config";
import { MdproDeck, MdproResp } from "./schema";
import { MdproDeckLike, MdproResp } from "./schema";
import { handleHttps, mdproHeaders } from "./util";
const { mdproServer } = useConfig();
......@@ -25,7 +25,7 @@ interface RespData {
size: number;
total: number;
pages: number;
records: MdproDeck[];
records: MdproDeckLike[];
}
export async function pullDecks(
......
......@@ -24,4 +24,15 @@ export interface MdproDeck {
/* Content of the deck. */
deckYdk?: string;
deckCase: number;
/* User ID of MyCard Account */
userId: number;
}
export interface MdproDeckLike {
deckId: string;
deckContributor: string;
deckName: string;
deckLike: string;
deckCase: number;
lastDate: string;
}
......@@ -3,7 +3,7 @@ import { proxy } from "valtio";
import { type NeosStore } from "./shared";
export interface User {
id: string;
id: number;
username: string;
name: string;
email: string;
......
......@@ -4,7 +4,7 @@ import { type INTERNAL_Snapshot as Snapshot, proxy, useSnapshot } from "valtio";
import YGOProDeck from "ygopro-deck-encode";
import { mgetDeck, pullDecks } from "@/api";
import { MdproDeck } from "@/api/mdproDeck/schema";
import { MdproDeckLike } from "@/api/mdproDeck/schema";
import { useConfig } from "@/config";
import { IconFont } from "@/ui/Shared";
......@@ -18,7 +18,7 @@ const { assetsPath } = useConfig();
interface Props {
query: string;
page: number;
decks: MdproDeck[];
decks: MdproDeckLike[];
total: number;
}
......@@ -102,7 +102,7 @@ export const DeckResults: React.FC = memo(() => {
);
});
const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
const MdproDeckBlock: React.FC<Snapshot<MdproDeckLike>> = (deck) => (
<div
className={styles["mdpro-deck"]}
onClick={async () => await copyMdproDeckToEditing(deck)}
......@@ -119,7 +119,7 @@ const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
</div>
);
const copyMdproDeckToEditing = async (mdproDeck: MdproDeck) => {
const copyMdproDeckToEditing = async (mdproDeck: MdproDeckLike) => {
// currently the content of the deck, which we named `Ydk`,
// haven't been downloaded, so we need to fetch from server again by `mgetDeck`
// API.
......
......@@ -136,6 +136,7 @@ export const DeckSelect: React.FC<{
deckName: deck.deckName,
deckYdk: genYdkText(deck),
deckCase: DEFAULT_DECK_CASE,
userId: user.id,
};
const resp = await uploadDeck(mdproDeck);
......
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