delete.go 910 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package web
  2. import (
  3. "net/http"
  4. "github.com/gin-contrib/sessions"
  5. "github.com/gin-gonic/gin"
  6. "code.osinet.fr/fgm/sqs_demo/back/services/redriver"
  7. )
  8. func makeDeleteHandler(rd redriver.Redriver) gin.HandlerFunc {
  9. return func(c *gin.Context) {
  10. qName := c.Param("name")
  11. sess := sessions.Default(c)
  12. flashes := sess.Flashes()
  13. sess.Clear()
  14. sess.Save()
  15. c.HTML(http.StatusOK, "confirm", gin.H{
  16. "flashes": flashes,
  17. "question": "Do you confirm this deletion request ?",
  18. "description": "The message cannot be recovered after that step",
  19. "cancel": "Cancel",
  20. "confirm": "Delete",
  21. "redirect": "/queue/" + qName,
  22. })
  23. }
  24. return nil
  25. }
  26. func makeDeleteConfirmHandler(rd redriver.Redriver) gin.HandlerFunc {
  27. return func(c *gin.Context) {
  28. c.JSON(http.StatusServiceUnavailable, gin.H{
  29. "message": "deletion confirmation",
  30. "error": "not implemented",
  31. })
  32. }
  33. }