fix: check if session exists for see other

This commit is contained in:
Teajey 2024-12-29 20:41:42 +13:00
parent dd952a1f39
commit ffd3890584
Signed by: Teajey
GPG Key ID: 970E790FE834A713
1 changed files with 7 additions and 5 deletions

View File

@ -29,6 +29,7 @@ func (res *Response) Write(w http.ResponseWriter, r *http.Request) error {
if res.SeeOther != "" { if res.SeeOther != "" {
http.Redirect(w, r, res.SeeOther, http.StatusSeeOther) http.Redirect(w, r, res.SeeOther, http.StatusSeeOther)
if res.Session != nil {
flash := res.Session.FlashPeek() flash := res.Session.FlashPeek()
if flash != nil { if flash != nil {
err := json.NewEncoder(w).Encode(flash) err := json.NewEncoder(w).Encode(flash)
@ -36,6 +37,7 @@ func (res *Response) Write(w http.ResponseWriter, r *http.Request) error {
return err return err
} }
} }
}
return nil return nil
} }