feat: frontend

This commit is contained in:
2025-11-17 21:07:51 -07:00
parent dd0ab39985
commit e1396e2d24
87 changed files with 13616 additions and 148 deletions

View File

@@ -8,6 +8,7 @@ import (
"log"
"net/http"
"net/url"
"ordr-api/dto"
"os"
"github.com/gin-contrib/sessions"
@@ -81,7 +82,10 @@ func LoginHandler(auth *Authenticator) gin.HandlerFunc {
}
audience_url := "https://" + os.Getenv("AUTH0_DOMAIN") + "/api/v2/"
auth_url := auth.AuthCodeURL(state, oauth2.AccessTypeOffline, oauth2.SetAuthURLParam("audience", audience_url))
ctx.Redirect(http.StatusTemporaryRedirect, auth_url)
var redirect dto.LoginRedirect
redirect.Status = "200 OK"
redirect.Location = auth_url
ctx.JSON(http.StatusOK, redirect)
}
}
@@ -163,7 +167,7 @@ func AuthenticationCallbackHandler(auth *Authenticator) gin.HandlerFunc {
}
// Redirect to logged in page.
ctx.Redirect(http.StatusTemporaryRedirect, "/user")
ctx.Redirect(http.StatusTemporaryRedirect, os.Getenv("LOGGED_IN_REDIRECT"))
}
}