Commit 60951143 authored by xiaoye's avatar xiaoye

fix

parent 4286fbcd
This diff is collapsed.
...@@ -22,7 +22,7 @@ import { ...@@ -22,7 +22,7 @@ import {
AllMatch, AllMatch,
AllAPI, AllAPI,
UserObject, UserObject,
TournamentAParticipant TournamentGet
} from './type.ts' } from './type.ts'
import UniApp from './uniapp.ts'; import UniApp from './uniapp.ts';
...@@ -79,7 +79,7 @@ class TabulatorAPI { ...@@ -79,7 +79,7 @@ class TabulatorAPI {
return false; return false;
} }
}, },
Find : async (token : string, id : number) : Promise<TournamentAParticipant> => { Find : async (token : string, id : number) : Promise<TournamentGet> => {
let response : { let response : {
data : { data : {
data : TournamentObject; data : TournamentObject;
...@@ -92,14 +92,22 @@ class TabulatorAPI { ...@@ -92,14 +92,22 @@ class TabulatorAPI {
} }
}); });
let participants : Array<Participant> = []; let participants : Array<Participant> = [];
let matches : Array<Match> = [];
response.data.data.participants.forEach((i : ParticipantObject) => { response.data.data.participants.forEach((i : ParticipantObject) => {
participants.push(new Participant(i)); participants.push(new Participant(i));
}); });
response.data.data.matches.forEach((i : MatchObject) => {
matches.push(new Match(i));
});
return { return {
tournament : new Tournament(response.data.data), tournament : new Tournament(response.data.data),
participant : { participant : {
participants : participants, participants : participants,
total : participants.length total : participants.length
},
match : {
matches : matches,
total : matches.length
} }
}; };
} }
...@@ -110,6 +118,10 @@ class TabulatorAPI { ...@@ -110,6 +118,10 @@ class TabulatorAPI {
participant : { participant : {
participants : [], participants : [],
total : 0 total : 0
},
match : {
matches : [],
total : 0
} }
}; };
} }
...@@ -496,14 +508,14 @@ class TabulatorAPI { ...@@ -496,14 +508,14 @@ class TabulatorAPI {
}) })
return { return {
total : response.data.total, total : response.data.total,
matchs : matchs matches : matchs
}; };
} }
catch(error) { catch(error) {
console.error(error); console.error(error);
return { return {
total : 0, total : 0,
matchs : [] matches : []
}; };
} }
}, },
......
...@@ -64,6 +64,7 @@ interface TournamentObject extends TournamentCreateObject { ...@@ -64,6 +64,7 @@ interface TournamentObject extends TournamentCreateObject {
creator : number; creator : number;
createdAt : string; createdAt : string;
participants : Array<ParticipantObject>; participants : Array<ParticipantObject>;
matches : Array<MatchObject>
} }
interface TournamentFindObject { interface TournamentFindObject {
...@@ -144,16 +145,17 @@ interface AllParticipant extends All { ...@@ -144,16 +145,17 @@ interface AllParticipant extends All {
} }
interface AllMatch extends All { interface AllMatch extends All {
matchs : Array<Match>; matches : Array<Match>;
} }
interface AllAPI extends All { interface AllAPI extends All {
api : Array<ApiKey>; api : Array<ApiKey>;
} }
interface TournamentAParticipant { interface TournamentGet {
tournament : Tournament | undefined; tournament : Tournament | undefined;
participant : AllParticipant participant : AllParticipant,
match : AllMatch
} }
interface UserObject { interface UserObject {
...@@ -189,6 +191,6 @@ export { ...@@ -189,6 +191,6 @@ export {
AllAPI, AllAPI,
ruleSettings, ruleSettings,
UserObject, UserObject,
TournamentAParticipant, TournamentGet,
Deck Deck
} }
\ No newline at end of file
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