question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Router to highjack forms as well as anchors

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dperrymorrowcommented, Apr 14, 2022

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

0reactions
aidenybaicommented, Apr 14, 2022

Agreed with @Borrus-sudo! I like the ideas presented here. Closing in favor of merging to #177

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found