Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Yesod alternative to the Rails' `link_to foo, bar, method: "delete"?

Tags:

haskell

yesod

Is there a simple way to generate a link that uses a different method than GET in Yesod, such as in Ruby on Rails, where one can do link_to foo, bar, method: "post", which would submit the link via JavaScript?

update: What Ruby on Rails does is that it generates a data-method attribute, which is then handled by its own JavaScript library. I'm not necessarily looking for exactly the same solution, but rather if there is an existing mechanism for creating POST links in Yesod.

like image 948
Jakub Arnold Avatar asked Jan 08 '23 23:01

Jakub Arnold


1 Answers

Is there a simple way to generate a link that uses a different method than GET in Yesod

Not that I'm aware of.

an existing mechanism for creating POST links in Yesod

To generate POST links specifically, you could render a form styled to look like a link. You could probably wrap this up in a postLink :: Route -> Widget helper.

like image 86
pbrisbin Avatar answered Jan 22 '23 19:01

pbrisbin