delete autoupdate and lang

This commit is contained in:
Данил 2022-09-21 10:47:18 +03:00
parent 7c75974bfe
commit 8014e7a7ff

View file

@ -27,15 +27,14 @@ var SettingsGet = func(w http.ResponseWriter, r *http.Request) {
} }
}(query) }(query)
var lang string var autostart, autochangewallpaper int
var autostart, autoupdate, autochangewallpaper int
for query.Next() { for query.Next() {
err := query.Scan(&lang, &autostart, &autoupdate, &autochangewallpaper) err := query.Scan(&autostart, &autochangewallpaper)
if err != nil { if err != nil {
panic(err) panic(err)
} }
var data = map[string]interface{}{"lang": lang, "autostart": autostart, "autoupdate": autoupdate, "autochangewallpaper": autochangewallpaper} var data = map[string]interface{}{"autostart": autostart, "autochangewallpaper": autochangewallpaper}
utils.Respond(w, data) utils.Respond(w, data)
} }
} }
@ -46,23 +45,14 @@ var SettingsUpdate = func(w http.ResponseWriter, r *http.Request) {
panic(errOpen) panic(errOpen)
} }
lang := r.FormValue("lang")
autostart := r.FormValue("autostart") autostart := r.FormValue("autostart")
autoupdate := r.FormValue("autoupdate")
autochangewallpaper := r.FormValue("autochangewallpaper") autochangewallpaper := r.FormValue("autochangewallpaper")
if lang == "" && autostart == "" && autoupdate == "" && autochangewallpaper == "" { if autostart == "" && autochangewallpaper == "" {
utils.Respond(w, utils.Message(false, "All fields are required")) utils.Respond(w, utils.Message(false, "All fields are required"))
return return
} }
if lang != "" {
_, err := db.Exec("UPDATE settings SET lang = ?", lang)
if err != nil {
panic(err)
}
}
if autostart != "" { if autostart != "" {
_, err := db.Exec("UPDATE settings SET autostart = ?", autostart) _, err := db.Exec("UPDATE settings SET autostart = ?", autostart)
if err != nil { if err != nil {
@ -70,13 +60,6 @@ var SettingsUpdate = func(w http.ResponseWriter, r *http.Request) {
} }
} }
if autoupdate != "" {
_, err := db.Exec("UPDATE settings SET autoupdate = ?", autoupdate)
if err != nil {
panic(err)
}
}
if autochangewallpaper != "" { if autochangewallpaper != "" {
_, err := db.Exec("UPDATE settings SET autochangewallpaper = ?", autochangewallpaper) _, err := db.Exec("UPDATE settings SET autochangewallpaper = ?", autochangewallpaper)
if err != nil { if err != nil {