refactor: change /api/oauth/twitter to /api/twitter/oauth
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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>
|
||||||
Reference in New Issue
Block a user