Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intercept http status 419 somehow to popup the TC modal window #22

Open
brecke opened this issue Mar 27, 2021 · 0 comments
Open

Intercept http status 419 somehow to popup the TC modal window #22

brecke opened this issue Mar 27, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@brecke
Copy link
Member

brecke commented Mar 27, 2021

In 3akai-ux this is what we have:

    function(oae, $) {
        $.ajaxSetup({
            // Make caching the default behavior for $.getScript
            'cache': true,
            // Intercept 419 status indicating that the user has to accept the Terms and Conditions before continuing
            'complete': function(xhr, textStatus) {
                if (xhr.status === 419) {
                    // Update user status
                    oae.data.me.needsToAcceptTC = true;
                    // Hide any modal that might be open as bootstrap doesn't support 2 modals at once
                    $('.modal').modal('hide');
                    // Insert the Terms and Conditions widget in settings mode
                    var termsandconditionsId = oae.api.util.generateId();
                    oae.api.widget.insertWidget('termsandconditions', termsandconditionsId, null, true);
                }
            }
        });
        // Make sure that arrays passed in as arguments are properly encoded
        $.ajaxSettings.traditional = true;
        // Tell IE9 that cross-domain requests are a possibility when Amazon S3 is enabled
        // as the content storage strategy
        $.support.cors = true;

        return oae;
    }
@brecke brecke added the enhancement New feature or request label Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant