rename handler functions
This commit is contained in:
@@ -163,7 +163,7 @@ func processGithubUserInfo(state string, code string, c *gin.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func HandleOAuthCallback(provider enum.OAuthProvider) gin.HandlerFunc {
|
||||
func OAuthCallbackHandler(provider enum.OAuthProvider) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
var err error
|
||||
if provider == enum.GoogleProvider {
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/yauthdev/yauth/server/session"
|
||||
)
|
||||
|
||||
func HandleOAuthLogin(provider enum.OAuthProvider) gin.HandlerFunc {
|
||||
func OAuthLoginHandler(provider enum.OAuthProvider) gin.HandlerFunc {
|
||||
uuid := uuid.New()
|
||||
oauthStateString := uuid.String()
|
||||
|
||||
|
@@ -5,7 +5,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Defining the Playground handler
|
||||
func PlaygroundHandler() gin.HandlerFunc {
|
||||
h := playground.Handler("GraphQL", "/graphql")
|
||||
|
||||
|
@@ -13,8 +13,7 @@ import (
|
||||
"github.com/yauthdev/yauth/server/utils"
|
||||
)
|
||||
|
||||
// Defining the Graphql handler
|
||||
func VerifyEmail() gin.HandlerFunc {
|
||||
func VerifyEmailHandler() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
errorRes := gin.H{
|
||||
"message": "invalid token",
|
||||
|
@@ -42,14 +42,14 @@ func main() {
|
||||
r.Use(CORSMiddleware())
|
||||
r.GET("/", handlers.PlaygroundHandler())
|
||||
r.POST("/graphql", handlers.GraphqlHandler())
|
||||
r.GET("/verify_email", handlers.VerifyEmail())
|
||||
r.GET("/verify_email", handlers.VerifyEmailHandler())
|
||||
if oauth.OAuthProvider.GoogleConfig != nil {
|
||||
r.GET("/login/google", handlers.HandleOAuthLogin(enum.GoogleProvider))
|
||||
r.GET("/callback/google", handlers.HandleOAuthCallback(enum.GoogleProvider))
|
||||
r.GET("/login/google", handlers.OAuthLoginHandler(enum.GoogleProvider))
|
||||
r.GET("/callback/google", handlers.OAuthCallbackHandler(enum.GoogleProvider))
|
||||
}
|
||||
if oauth.OAuthProvider.GithubConfig != nil {
|
||||
r.GET("/login/github", handlers.HandleOAuthLogin(enum.GithubProvider))
|
||||
r.GET("/callback/github", handlers.HandleOAuthCallback(enum.GithubProvider))
|
||||
r.GET("/login/github", handlers.OAuthLoginHandler(enum.GithubProvider))
|
||||
r.GET("/callback/github", handlers.OAuthCallbackHandler(enum.GithubProvider))
|
||||
}
|
||||
r.Run()
|
||||
}
|
||||
|
Reference in New Issue
Block a user