From 02de9a2df98fbde9027f590cd91a9ec077abd40a Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Wed, 10 Jul 2024 23:33:10 -0300 Subject: [PATCH] refactor: change /api/oauth/twitter to /api/twitter/oauth --- routes/router.go | 6 +++--- routes/{twitter_login.templ => twitter.templ} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename routes/{twitter_login.templ => twitter.templ} (93%) diff --git a/routes/router.go b/routes/router.go index 890cc9d..ff2ef9b 100644 --- a/routes/router.go +++ b/routes/router.go @@ -14,10 +14,10 @@ var ROUTES = []Route{ Handler: IndexHandler, }, { - Pattern: "/api/oauth/twitter", + Pattern: "/api/twitter/oauth", Static: false, - Page: TwitterLogin(), - Handler: TwitterLoginHandler, + Page: TwitterOAuth(), + Handler: TwitterOAuthHandler, }, { Pattern: "/robots.txt", diff --git a/routes/twitter_login.templ b/routes/twitter.templ similarity index 93% rename from routes/twitter_login.templ rename to routes/twitter.templ index 517750e..1e973b6 100644 --- a/routes/twitter_login.templ +++ b/routes/twitter.templ @@ -18,7 +18,7 @@ type TwitterTokenResponse struct { Scope string `json:"scope"` } -func TwitterLoginHandler(w http.ResponseWriter, r *http.Request) { +func TwitterOAuthHandler(w http.ResponseWriter, r *http.Request) { error := internals.HttpErrorHelper(w) code := r.URL.Query().Get("code") @@ -69,10 +69,10 @@ func TwitterLoginHandler(w http.ResponseWriter, r *http.Request) { c.Value = res.Token http.SetCookie(w, c) - TwitterLogin().Render(context.Background(), w) + TwitterOAuth().Render(context.Background(), w) } -templ TwitterLogin() { +templ TwitterOAuth() { @layouts.Page("Project Extrovert") {