Skip to content

feat: Improve redirects  #79

Description

@neznaika0

I continue to work with HTMX.
Should I redefine RedirectResponse(back(), route(), to()) and update redirect()?

$responseHTMX = single_service('redirectresponse')
        ->hxRedirect((string) previous_url(true))
        ->with(...$flashes)
        ;

$responseCI = redirect()->back()->with(...$flashes);

When the request came as HTMX, the redirect will have the initial headers. By making a regular redirect, the response will remain as for HTMX. Therefore, the second entry does not make sense.
Now we need to duplicate the code for different cases (HTMX or a regular request). Would it be better to combine these conditions inside the new functions?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions