Revision dbe026f9
b/ui/static/snf/js/sync.js | ||
---|---|---|
70 | 70 |
// appends global ajax handlers |
71 | 71 |
// handles changed-since url parameter based on api path |
72 | 72 |
api.sync = function(method, model, options) { |
73 |
|
|
73 |
|
|
74 | 74 |
var type = methodMap[method]; |
75 | 75 |
|
76 | 76 |
if (model && (model.skipMethods || []).indexOf(method) >= 0) { |
77 | 77 |
throw "Model does not support " + method + " calls"; |
78 | 78 |
} |
79 |
|
|
79 |
|
|
80 | 80 |
if (!options.url) { |
81 |
var urlobject = model; |
|
82 |
|
|
83 |
// fallback to collection url for item creation |
|
84 |
if (method == "create" && model.isNew && model.isNew()) { |
|
85 |
urlobject = model.collection; |
|
86 |
} |
|
87 |
|
|
81 | 88 |
options.url = getUrl(model, options) || urlError(); |
82 | 89 |
if (model && model.supportIncUpdates) { |
83 | 90 |
options.url = options.refresh ? options.url : setChangesSince(options.url, type); |
Also available in: Unified diff