refactor: change /api/oauth/twitter to /api/twitter/oauth

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-07-10 23:33:10 -03:00
parent 153d862573
commit 02de9a2df9
2 changed files with 6 additions and 6 deletions

View File

@@ -14,10 +14,10 @@ var ROUTES = []Route{
Handler: IndexHandler, Handler: IndexHandler,
}, },
{ {
Pattern: "/api/oauth/twitter", Pattern: "/api/twitter/oauth",
Static: false, Static: false,
Page: TwitterLogin(), Page: TwitterOAuth(),
Handler: TwitterLoginHandler, Handler: TwitterOAuthHandler,
}, },
{ {
Pattern: "/robots.txt", Pattern: "/robots.txt",

View File

@@ -18,7 +18,7 @@ type TwitterTokenResponse struct {
Scope string `json:"scope"` Scope string `json:"scope"`
} }
func TwitterLoginHandler(w http.ResponseWriter, r *http.Request) { func TwitterOAuthHandler(w http.ResponseWriter, r *http.Request) {
error := internals.HttpErrorHelper(w) error := internals.HttpErrorHelper(w)
code := r.URL.Query().Get("code") code := r.URL.Query().Get("code")
@@ -69,10 +69,10 @@ func TwitterLoginHandler(w http.ResponseWriter, r *http.Request) {
c.Value = res.Token c.Value = res.Token
http.SetCookie(w, c) http.SetCookie(w, c)
TwitterLogin().Render(context.Background(), w) TwitterOAuth().Render(context.Background(), w)
} }
templ TwitterLogin() { templ TwitterOAuth() {
@layouts.Page("Project Extrovert") { @layouts.Page("Project Extrovert") {
<dialog open> <dialog open>
<article> <article>