mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-21 16:26:21 +03:00
Added answers from api about errors and successful wallpaper change
This commit is contained in:
parent
45fe8f981e
commit
7ba118f9b6
1 changed files with 6 additions and 1 deletions
|
@ -1,10 +1,11 @@
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/Redume/EveryNasa/api/utils"
|
"github.com/Redume/EveryNasa/api/utils"
|
||||||
"github.com/Redume/EveryNasa/functions"
|
"github.com/Redume/EveryNasa/functions"
|
||||||
"github.com/reujab/wallpaper"
|
"github.com/reujab/wallpaper"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var WallpaperUpdate = func(w http.ResponseWriter, r *http.Request) {
|
var WallpaperUpdate = func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -18,5 +19,9 @@ var WallpaperUpdate = func(w http.ResponseWriter, r *http.Request) {
|
||||||
err := wallpaper.SetFromURL(url)
|
err := wallpaper.SetFromURL(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
functions.Logger(err.Error())
|
functions.Logger(err.Error())
|
||||||
|
utils.Respond(w, utils.Message(false, "An error occurred while setting the wallpaper"))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.Respond(w, utils.Message(true, "Wallpaper successfully updated"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue