-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: feat/gno-input-form
Are you sure you want to change the base?
Conversation
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()) | ||
} | ||
}) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redirect to encoded url
No description provided.