Skip to content

wip: use query instead of form #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: feat/gno-input-form
Choose a base branch
from

Conversation

gfanton
Copy link

@gfanton gfanton commented Apr 5, 2025

No description provided.

Comment on lines +44 to +60
router.HandleFunc("/", func(res *mux.ResponseWriter, req *mux.Request) {
hasDenom, hasAddr := req.Query.Has("denom"), req.Query.Has("addr")
switch {
case hasAddr && hasDenom:
denom := req.Query.Get("denom")
addr := req.Query.Get("addr")
res.Write(renderAddressBalance(denom, std.Address(addr)))

case hasDenom:
denom := req.Query.Get("denom")
totalSupply := TotalSupply(denom)
res.Write(renderCoinInfo(denom, totalSupply))

default: // default rendering
res.Write(renderHomepage())
}
})
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people have to implement query handling in their realm

redirectPath += ":" + strings.Join(parts, "/")
}
// override form with query
gnourl.Query = r.Form
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply use form input as it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually its override query with form (lol)


// Redirect to the new URL
http.Redirect(w, r, redirectPath, http.StatusSeeOther)
http.Redirect(w, r, gnourl.EncodeWebURL(), http.StatusSeeOther)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redirect to encoded url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant