mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-10-26 12:17:36 -05:00
Preact: Improve error when challenging without required team (#2484)
This commit is contained in:
@@ -781,8 +781,15 @@ export class TeamForm extends preact.Component<{
|
||||
submit = (ev: Event, validate?: 'validate') => {
|
||||
ev.preventDefault();
|
||||
const format = this.format;
|
||||
const teamKey = this.base!.querySelector<HTMLButtonElement>('button[name=team]')!.value;
|
||||
const teamElement = this.base!.querySelector<HTMLButtonElement>('button[name=team]');
|
||||
const teamKey = teamElement!.value;
|
||||
const team = teamKey ? PS.teams.byKey[teamKey] : undefined;
|
||||
if (!window.BattleFormats[toID(format)]?.team && !team) {
|
||||
PS.alert('You need to go into the Teambuilder and build a team for this format.', {
|
||||
parentElem: teamElement!,
|
||||
});
|
||||
return;
|
||||
}
|
||||
PS.teams.loadTeam(team).then(() => {
|
||||
(validate === 'validate' ? this.props.onValidate : this.props.onSubmit)?.(ev, format, team);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user