Skip to content

feat: Improve redirects  #79

@neznaika0

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?

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