Skip to content

Cancel replace on pjax:beforeReplace #427

Closed
@jspizziri

Description

@jspizziri

I would like to suggest being able to cancel pjax on the beforeReplace event.

    //Check if replace should be canceled
    if(!fire('pjax:beforeReplace', [container.contents, options], {
      state: pjax.state,
      previousState: previousState
    })){
        return false;
    }

Here is my use case: If a user is logged in and their session times out the next pjax call will load the result of the unauthenticated request (likely a login form). In this instance I would like to be able to cancel pjax gracefully so that I may present a login UI that I desire.

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