diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2021-03-04 18:50:47 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2021-03-04 18:50:47 -0500 |
| commit | 3b6f5647b0689abf04be73c3cf00297051753435 (patch) | |
| tree | 3de6871abf37849c1e9f86dfc90ee2b3ed74c66e /cmd/web/delete.go | |
| parent | eaf02771d767e4745572d9b00e71e138ee030e60 (diff) | |
| download | steam-export-3b6f5647b0689abf04be73c3cf00297051753435.tar.gz steam-export-3b6f5647b0689abf04be73c3cf00297051753435.tar.xz | |
Refactor. Pull most of the functions into methods off of an App struct.
Kill most global variables.
Diffstat (limited to 'cmd/web/delete.go')
| -rw-r--r-- | cmd/web/delete.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/web/delete.go b/cmd/web/delete.go index 49a1326..7fa003e 100644 --- a/cmd/web/delete.go +++ b/cmd/web/delete.go @@ -5,7 +5,7 @@ import ( "net/http" ) -func gameDelete(w http.ResponseWriter, r *http.Request) { +func (a App) HandleDelete(w http.ResponseWriter, r *http.Request) { if unauthorizedIfNotLocal(w, r) { return } @@ -25,9 +25,9 @@ func gameDelete(w http.ResponseWriter, r *http.Request) { return } - Lib.Lock() - g, ok := Lib.Games[game] - Lib.Unlock() + a.Library.Lock() + g, ok := a.Library.Games[game] + a.Library.Unlock() if !ok { Logger.Printf("Missing: %s", game) http.Error(w, "Game is missing", 404) @@ -42,6 +42,6 @@ func gameDelete(w http.ResponseWriter, r *http.Request) { } Logger.Printf("Removed game: %s", game) - reloadLib() + a.LibraryReload() http.Redirect(w, r, "/", 302) } |
