Re: TimelineFilter.js

From disqus.com, 8 Months ago, written in JavaScript, viewed 3 times. This paste is a reply to TimelineFilter.js from disqus.com - go back
URL https://pastebin.freepbx.org/view/25caeaff/diff Embed
Viewing differences between TimelineFilter.js and Re: TimelineFilter.js
define('home/models/TimelineFilter',[
    'backbone',

    'core/api',
    'core/config',
], function (
    Backbone,

    api,
    config
) {
    'use strict';

    return Backbone.Model.extend({

        urls: {
            'update': api.getURL('timelines/filters/add'),
            'delete': api.getURL('timelines/filters/remove'),
        },

        parse: function (response) {
            return response.response || response;
        },

        serializeData: function () {
            return {
                filter: this.id,
                api_key: config.keys.api,
            };
        },

        sync: function (method, model, options) {
            options.emulateHTTP = true;
            options.emulateJSON = false;
            options.processData = true;
            if (method === 'update' || method === 'delete')
                options.data = model.serializeData();
            options.url = this.urls[method];
            return Backbone.Model.prototype.sync.call(this, method, model, options);
        },

    }, {
        // IDs of filters
        FILTER_LIKEPOST: 'likepost',
        FILTER_INVITE: 'invite',
        FILTER_RECOMMEND: 'favoritethread',
        FILTER_THREADREPLIES: 'threadreplies',
        FILTER_MENTIONS: 'mentions',
    });
});

// https://c.disquscdn.com/next/82c6de3/home/js/models/TimelineFilter.js

Reply to "Re: TimelineFilter.js"

Here you can reply to the paste above