feat: boost pagination and sorting links with htmx
This commit is contained in:
1 parent
493a43d952
commit
13e5b6c3af
8 files changed
+37
-11
No files matched your search
@@ -51,11 +51,15 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
|
||||
* The firewall saves the requested url as the target path right before it calls this. An
|
||||
* htmx request is a fragment - a modal, a table body - that cannot stand as a page, so
|
||||
* after the login it must not be where the user lands. htmx does not send the
|
||||
* X-Requested-With header that would make Symfony skip it on its own.
|
||||
* X-Requested-With header that would make Symfony skip it on its own. A boosted request
|
||||
* (a paginator or sort link) is the exception: it fetches a whole page and stays the deeplink.
|
||||
*/
|
||||
public function start(Request $request, ?AuthenticationException $authException = null): Response
|
||||
{
|
||||
if (true === $request->headers->has('HX-Request') && true === $request->hasSession()) {
|
||||
if (true === $request->headers->has('HX-Request')
|
||||
&& false === $request->headers->has('HX-Boosted')
|
||||
&& true === $request->hasSession()
|
||||
) {
|
||||
$this->removeTargetPath($request->getSession(), self::FIREWALL_NAME);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user