Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "watchPage": (page, expiry, callback) => {
- // https://www.mediawiki.org/wiki/API:Watch
- // MediawikiJS api
- const expireParam = expiry == 0 ? { unwatch: true } : { expiry: expiry };
- new mw.Api().postWithToken('watch', { action: 'watch', titles: page, format: 'json', ...expireParam }).done((data) => {
- if (data.errors == null || data.errors.length < 1) {
- callback(true);
- } else {
- console.error(data);
- callback(false);
- }
- }).fail(() => {
- console.log("fail received") /* when testing i saw this logged */
- callback(false)
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement