Skip to content

Commit

Permalink
✨ remove html flows on verify email
Browse files Browse the repository at this point in the history
  • Loading branch information
codermuss committed Aug 4, 2024
1 parent eb30bae commit d801092
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (server *Server) setupRouter() {

router.Use(ZerologMiddleware())
router.Use(gin.Recovery())
router.LoadHTMLGlob("/Users/mustafayilmaz/Go/projects/musarchive/templates/*")

// Serve the API endpoints
api := router.Group("/v1")
Expand Down
30 changes: 15 additions & 15 deletions api/verify_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package api

import (
"net/http"
"time"

"github.com/gin-gonic/gin"
db "github.com/mustafayilmazdev/musarchive/db/sqlc"
Expand Down Expand Up @@ -34,22 +33,23 @@ func (server *Server) VerifyEmail(ctx *gin.Context) {
})

if err != nil {
data := gin.H{
"Title": server.lm.Translate(req.Locale, localization.User_VerifyEmailErrorTitle),
"Timestamp": time.Now().Format(time.RFC1123),
"Content": server.lm.Translate(req.Locale, localization.Errors_AnErrorOccured),
"ErrorMessage": err,
}
ctx.HTML(http.StatusOK, "error_verify_email.html", data)
BuildResponse(ctx, BaseResponse{
Code: http.StatusInternalServerError,
Message: ResponseMessage{
Type: ERROR,
Content: err.Error(),
},
})

return
}

data := gin.H{
"Title": server.lm.Translate(req.Locale, localization.User_VerifyEmailSuccessTitle),
"Timestamp": time.Now().Format(time.RFC1123),
"Content": server.lm.Translate(req.Locale, localization.User_VerifyEmailSuccess),
"WelcomeMessage": server.lm.Translate(req.Locale, localization.User_VerifyEmailMessage),
}
ctx.HTML(http.StatusOK, "success_verify_email.html", data)
BuildResponse(ctx, BaseResponse{
Code: http.StatusOK,
Message: ResponseMessage{
Type: SUCCESS,
Content: server.lm.Translate(req.Locale, localization.User_VerifyEmailMessage),
},
})

}

0 comments on commit d801092

Please sign in to comment.