mirror of
https://github.com/discourse/discourse.git
synced 2025-02-26 14:58:39 +08:00
25 lines
545 B
JavaScript
25 lines
545 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,
|
|
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;
|