This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/models/topic-timer.js.es6
2017-05-11 18:27:53 -04:00

26 lines
608 B
JavaScript

import { ajax } from 'discourse/lib/ajax';
import RestModel from 'discourse/models/rest';
const TopicTimer = RestModel.extend({});
TopicTimer.reopenClass({
updateStatus(topicId, time, basedOnLastPost, statusType, categoryId) {
let data = {
time: time,
timezone_offset: (new Date().getTimezoneOffset()),
status_type: statusType
};
if (basedOnLastPost) data.based_on_last_post = basedOnLastPost;
if (categoryId) data.category_id = categoryId;
return ajax({
url: `/t/${topicId}/timer`,
type: 'POST',
data
});
}
});
export default TopicTimer;