diff --git a/teams.pokemonshowdown.com/src/teams-view.tsx b/teams.pokemonshowdown.com/src/teams-view.tsx index e2d97f59e..358e0eabe 100644 --- a/teams.pokemonshowdown.com/src/teams-view.tsx +++ b/teams.pokemonshowdown.com/src/teams-view.tsx @@ -308,6 +308,8 @@ export class TeamViewer extends preact.Component { {this.state.changesMade && <>
} +
+
} @@ -390,6 +392,27 @@ export class TeamViewer extends preact.Component { }); } + runDelete() { + const conf = toID(prompt("Do you really want to delete this team? Type 'yes' to confirm.")); + if (conf !== 'yes') { + return; + } + void query('deleteteam', { query: { teamid: this.id } }).then(result => { + if (result.actionerror) { + alert(`Error deleting team: ${result.actionerror}`); + } else { + alert( + result.success ? + `Team successfully deleted.` : + `Error while deleting team. Please try again later.` + ); + if (result.success) { + location.replace(''); + } + } + }); + } + copyTeam() { if (!this.state.team) return; const team = unpackTeam(this.state.team.team);