Send custom headers

This example shows how to use events to send a CSFR token with upload request.

    Code

    <!DOCTYPE html>
    <html>
        <head>
            <title>Revolvapp</title>
            <meta charset="utf-8">
    
            <!-- css -->
            <link rel="stylesheet" href="/your-folder/revolvapp.css" />
        </head>
        <body>
            <!-- element -->
            <div id="myemail"></div>
    
            <!-- js -->
            <script src="/your-folder/revolvapp.js"></script>
    
            <!-- call -->
            <script>
            Revolvapp('#myemail', {
                editor: {
                    path: '/your-path-to-revolvapp-folder/',
                    template: '/your-path-to-template-file.html'
                },
                image: {
                    upload: '/my-backend-upload/'
                },
                subscribe: {
                    'upload.before.send': function(event) {
                        var xhr = event.get('xhr');
                        xhr.setRequestHeader('X-CSRF-Token', 'your-token-value');
                    }
                }
            });
            </script>
        </body>
    </html>