refactor: renamed deletePlayer -> removePlayer for consistency

This commit is contained in:
Settel 2022-12-12 22:58:48 +01:00
parent b2e402f4bb
commit 014f78b040
6 changed files with 10 additions and 10 deletions

View File

@ -100,7 +100,7 @@ const playerDialogSubmit = async (action: ButtonAction): Promise<void> => {
break break
case 'delete': case 'delete':
if (confirm(`"${playerDialogPlayer.value.name}" löschen?`)) { if (confirm(`"${playerDialogPlayer.value.name}" löschen?`)) {
await useEngine().deletePlayer(playerDialogPlayer.value.id) await useEngine().removePlayer(playerDialogPlayer.value.id)
emit('update') emit('update')
} }
break break

View File

@ -36,9 +36,9 @@ export async function savePlayer(this: EngineContext, player: PlayerEdit): Promi
}) })
} }
export async function deletePlayer(this: EngineContext, id: string): Promise<void> { export async function removePlayer(this: EngineContext, id: string): Promise<void> {
const userInfoStore = useUserinfoStore() const userInfoStore = useUserinfoStore()
await this.callApi('/api/deletePlayer', { await this.callApi('/api/removePlayer', {
g: userInfoStore.gameId, g: userInfoStore.gameId,
id, id,
}) })

View File

@ -3,7 +3,7 @@ import { callApi, QueryParams } from '@/composables/engine/callApi'
import { start, stop } from '@/composables/engine/startStop' import { start, stop } from '@/composables/engine/startStop'
import { fetchUpdate } from '@/composables/engine/fetchUpdate' import { fetchUpdate } from '@/composables/engine/fetchUpdate'
import { loadQuotes, getQuotesRef, deleteQuote, saveQuote } from '@/composables/engine/quotes' import { loadQuotes, getQuotesRef, deleteQuote, saveQuote } from '@/composables/engine/quotes'
import { fetchGameInfo, fetchGameInfos, setGameLang, setGameName, savePlayer, deletePlayer, createGame, cameo, logoutCameo } from '@/composables/engine/gameManagement' import { fetchGameInfo, fetchGameInfos, setGameLang, setGameName, savePlayer, removePlayer, createGame, cameo, logoutCameo } from '@/composables/engine/gameManagement'
import { collectQuotes, startGame, continueGame, resetGame, finishGame, disableGame, removeGame } from '@/composables/engine/gameState' import { collectQuotes, startGame, continueGame, resetGame, finishGame, disableGame, removeGame } from '@/composables/engine/gameState'
import { saveSelection } from '@/composables/engine/play' import { saveSelection } from '@/composables/engine/play'
import type { Quotes, GameInfo, GameInfos, PlayerEdit, Lang, CreateGameStatus } from '@/composables/engine.d' import type { Quotes, GameInfo, GameInfos, PlayerEdit, Lang, CreateGameStatus } from '@/composables/engine.d'
@ -44,7 +44,7 @@ export interface useEngine {
setGameLang: (lang: string) => Promise<void> setGameLang: (lang: string) => Promise<void>
setGameName: (name: string) => Promise<void> setGameName: (name: string) => Promise<void>
savePlayer: (player: PlayerEdit) => Promise<void> savePlayer: (player: PlayerEdit) => Promise<void>
deletePlayer: (id: string) => Promise<void> removePlayer: (id: string) => Promise<void>
createGame: (name: string, teamname: string, lang: Lang) => Promise<CreateGameStatus> createGame: (name: string, teamname: string, lang: Lang) => Promise<CreateGameStatus>
cameo: (authcode: string) => Promise<void> cameo: (authcode: string) => Promise<void>
logoutCameo: () => Promise<void> logoutCameo: () => Promise<void>
@ -88,7 +88,7 @@ export default (): useEngine => {
setGameLang: (lang: string) => setGameLang.apply(context, [lang]), setGameLang: (lang: string) => setGameLang.apply(context, [lang]),
setGameName: (name: string) => setGameName.apply(context, [name]), setGameName: (name: string) => setGameName.apply(context, [name]),
savePlayer: (player: PlayerEdit) => savePlayer.apply(context, [player]), savePlayer: (player: PlayerEdit) => savePlayer.apply(context, [player]),
deletePlayer: (id: string) => deletePlayer.apply(context, [id]), removePlayer: (id: string) => removePlayer.apply(context, [id]),
createGame: (name: string, teamname: string, lang: Lang) => createGame.apply(context, [name, teamname, lang]), createGame: (name: string, teamname: string, lang: Lang) => createGame.apply(context, [name, teamname, lang]),
cameo: (authcode: string) => cameo.apply(context,[authcode]), cameo: (authcode: string) => cameo.apply(context,[authcode]),
logoutCameo: () => logoutCameo.apply(context), logoutCameo: () => logoutCameo.apply(context),

View File

@ -8,7 +8,7 @@ import (
"sirlab.de/go/knowyt/user" "sirlab.de/go/knowyt/user"
) )
func (app *Application) DeletePlayer(usr *user.User, w http.ResponseWriter, r *http.Request) { func (app *Application) RemovePlayer(usr *user.User, w http.ResponseWriter, r *http.Request) {
gameRef := r.URL.Query().Get("g") gameRef := r.URL.Query().Get("g")
gm, err := app.GetGameById(gameRef) gm, err := app.GetGameById(gameRef)
if err != nil { if err != nil {
@ -44,7 +44,7 @@ func (app *Application) DeletePlayer(usr *user.User, w http.ResponseWriter, r *h
fmt.Fprintf(w, "internal server error") fmt.Fprintf(w, "internal server error")
return return
} }
gm.DeletePlayer(deleteUser) gm.RemovePlayer(deleteUser)
delete(app.users, id) delete(app.users, id)
fmt.Fprintf(w, "ok") fmt.Fprintf(w, "ok")

View File

@ -86,7 +86,7 @@ func (gm *Game) UpdatePlayer(usr *user.User) {
gm.players[usrId] = player gm.players[usrId] = player
} }
func (gm *Game) DeletePlayer(usr *user.User) { func (gm *Game) RemovePlayer(usr *user.User) {
usrId := usr.GetId() usrId := usr.GetId()
gm.mu.Lock() gm.mu.Lock()

View File

@ -29,7 +29,7 @@ func main() {
mux.PrivateHandleFunc("/api/setGameName", app.SetGameName) mux.PrivateHandleFunc("/api/setGameName", app.SetGameName)
mux.PrivateHandleFunc("/api/setGameLang", app.SetGameLang) mux.PrivateHandleFunc("/api/setGameLang", app.SetGameLang)
mux.PrivateHandleFunc("/api/savePlayer", app.SavePlayer) mux.PrivateHandleFunc("/api/savePlayer", app.SavePlayer)
mux.PrivateHandleFunc("/api/deletePlayer", app.DeletePlayer) mux.PrivateHandleFunc("/api/removePlayer", app.RemovePlayer)
mux.PrivateHandleFunc("/api/sync", app.SyncHandler) mux.PrivateHandleFunc("/api/sync", app.SyncHandler)
mux.PrivateHandleFunc("/api/collectQuotes", app.CollectQuotes) mux.PrivateHandleFunc("/api/collectQuotes", app.CollectQuotes)
mux.PrivateHandleFunc("/api/startGame", app.StartGame) mux.PrivateHandleFunc("/api/startGame", app.StartGame)