From cbdfd34a5e60e8841eaef9ebcf9f8141cc157043 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:24:32 -0500 Subject: [PATCH] Teams: Add delete team button --- teams.pokemonshowdown.com/src/teams-view.tsx | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) 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);