Commit eb9ace2e authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/railway' into 'main'

Feat/railway

See merge request mycard/Neos!95
parents ac817345 78566fbe
Pipeline #19817 passed with stages
in 3 minutes and 57 seconds
{
"hero": {
"main": [
14124483,
9411399,
9411399,
18094166,
18094166,
18094166,
40044918,
40044918,
59392529,
50720316,
50720316,
27780618,
27780618,
16605586,
16605586,
22865492,
22865492,
23434538,
23434538,
14558127,
14558127,
13650422,
83965310,
81439173,
8949584,
8949584,
32807846,
52947044,
45906428,
24094653,
21143940,
21143940,
21143940,
48130397,
24224830,
24224830,
12071500,
24299458,
24299458,
10045474
],
"extra": [
86165817,
41209827,
29095552,
40854197,
60461804,
60461804,
22908820,
58481572,
58481572,
89870349,
46759931,
63813056,
1948619,
58004362,
58004362
],
"side": [
27204311,
34267821,
34267821,
43534808,
43534808,
94145021,
94145021,
18144506,
54693926,
54693926,
43898403,
43898403,
65681983,
23002292
]
}
}
import axios from "axios";
// import axios from "axios";
import DECKS from "./deck.json";
const DeckManager = _objToMap(DECKS);
export interface IDeck {
main?: number[];
......@@ -12,9 +15,18 @@ export interface IDeck {
* @param deck- 卡组名称
* @returns 卡组数据
*
* @todo - 这里应该为萌卡实现卡组存储
* */
export async function fetchDeck(deck: string): Promise<IDeck> {
const res = await axios.get<IDeck>("http://localhost:3030/deck/" + deck);
const res = DeckManager.get(deck);
return res || { main: [], extra: [], side: [] };
}
function _objToMap(object: any): Map<string, IDeck> {
let map = new Map();
Object.keys(object).forEach((key) => map.set(key, object[key]));
return res.data;
return map;
}
......@@ -67,7 +67,7 @@ export default function WaitRoom() {
const observerCount = useAppSelector(selectObserverCount);
const handleChoseDeck = async () => {
const deck = await fetchDeck("hero.ydk");
const deck = await fetchDeck("hero");
sendUpdateDeck(deck);
dispatch(initMeExtraDeckMeta({ controler: 0, codes: deck.extra || [] }));
......
import React, { useState } from "react";
const Editor = () => {
const [main, setMain] = useState([]);
const [extra, setExtra] = useState([]);
const [side, setSide] = useState([]);
return <></>;
};
export default Editor;
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