Commit 60951143 authored by xiaoye's avatar xiaoye

fix

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