[server]fix: error redirection for email verification

This commit is contained in:
Lakhan Samani
2023-05-02 18:39:10 +05:30
parent a6f6e0b18a
commit a50f6becbd
8 changed files with 57 additions and 22 deletions

17
server/utils/response.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
)
// HandleRedirectORJsonResponse handles the response based on redirectURL
func HandleRedirectORJsonResponse(c *gin.Context, httpResponse int, response map[string]interface{}, redirectURL string) {
if strings.TrimSpace(redirectURL) == "" {
c.JSON(httpResponse, response)
} else {
c.Redirect(http.StatusTemporaryRedirect, redirectURL)
}
}