redirect with 303 See Other

This commit is contained in:
cblgh 2021-04-15 11:00:34 +02:00
parent f535aa8f9c
commit 93f84e04b0
1 changed files with 1 additions and 5 deletions

View File

@ -275,7 +275,6 @@ func New(
m.Get(router.CompleteSetLanguage).HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
lang := req.FormValue("lang")
previousRoute := req.FormValue("page")
fmt.Println(lang, previousRoute)
session, err := cookieStore.Get(req, i18n.LanguageCookieName)
if err != nil {
@ -283,16 +282,13 @@ func New(
return
}
prevCookie := session.Values["lang"]
fmt.Println("previous cookie", prevCookie)
session.Values["lang"] = lang
err = session.Save(req, w)
if err != nil {
fmt.Printf("we failed to save the language session cookie %w\n", err)
}
http.Redirect(w, req, previousRoute, http.StatusTemporaryRedirect)
http.Redirect(w, req, previousRoute, http.StatusSeeOther)
})
// landing page