Compare commits

..

No commits in common. "9ea200464d5930063ddf7c94b601f85f979b1438" and "fbc6c9ca204aa4fe72fcb3dde3461878a7ea9137" have entirely different histories.

3 changed files with 7 additions and 13 deletions

View File

@ -80,7 +80,7 @@ func GetAllGroups() ([]Group, error) {
} }
func CreateGroup(name string, reference string) (*Group, error) { func CreateGroup(name string, reference string) (*Group, error) {
name = normalize.Trim(name) name = normalize.Name(name)
stmt := "INSERT INTO [group] (name, reference) VALUES (?, ?)" stmt := "INSERT INTO [group] (name, reference) VALUES (?, ?)"
result, err := database.Exec(stmt, name, reference) result, err := database.Exec(stmt, name, reference)
if err != nil { if err != nil {

View File

@ -29,13 +29,11 @@ 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) if err != nil {
if err != nil { return err
return err
}
} }
} }
return nil return nil

View File

@ -18,11 +18,7 @@ func (s *Session) FlashGet() any {
} }
func (s *Session) FlashPeek() any { func (s *Session) FlashPeek() any {
flash, ok := s.inner.Values["_flash"] list, _ := s.inner.Values["_flash"].([]any)
if !ok {
return nil
}
list := flash.([]any)
if len(list) < 1 { if len(list) < 1 {
return nil return nil
} else { } else {