feat: Router to highjack forms as well as anchors
See original GitHub issueIs your feature request related to a problem? Please describe. would be super helpful if router handled form submissions as well. I think this would make it feel much more “SPA like” than just doing anchor links. Many times this is what folks resort to a SPA for dealing with form validation ect…
Describe the solution you’d like Similar to how it handles clicks on the window, if it handled submit.
window.addEventListener("submit", async (event) => {
event.stopPropagation()
ev.preventDefault()
const body = Array.from(new FormData($form)).reduce((acc, [key, val]) => {
acc[key] = val
return acc
}, {})
const opts = {
method: $form.method,
headers,
redirect: 'follow'
}
let url = $form.action
if ($form.method.toLowerCase() === 'get') url += '?' + new URLSearchParams(body)
else opts.body = JSON.stringify(body)
const request = new Request(url, opts)
const res = await fetch(request)
// parse the response and patch the DOM....
})
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
The Confessions of Marcus Hutchins, the Hacker Who Saved ...
Hosting shady servers or stealing a few Facebook passwords or exploiting a hijacked computer to enlist it in DDoS attacks against other hackers— ......
Read more >what is cyber hijacking? - TechTarget
Cyber hijacking is a kind of network security attack in which an attacker takes control of computer systems, programs or network communications.
Read more >The Big Hack: How China Used a Tiny Chip to Infiltrate U.S. ...
The Big Hack: How China Used a Tiny Chip to Infiltrate U.S. Companies. The attack by Chinese spies reached almost 30 U.S. companies,...
Read more >Newsletters - NewsBites - SANS Institute
Join the SANS Community to receive the latest curated cyber security news, vulnerabilities and mitigations, training opportunities, and our webcast schedule.
Read more >hack ex ips
Even giants like Uber have been targeted by cybersecurity threats in the form of a massive hack to extract the data of 57...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Im happy to help with a PR if this is something you are interested in pursuing. Great library BTW!! There are not many “modern” takes on Virtual DOM out there currently
Agreed with @Borrus-sudo! I like the ideas presented here. Closing in favor of merging to #177