From 155ad712c33160a2440a7f4253ea0a374689a9b4 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Wed, 10 Jun 2015 17:08:14 +0200 Subject: [PATCH] StashEdit: Use postWithToken Because it does caching and retry for token problems by itself. Change-Id: Ic4e24f6c805de243225a23a3c445f578ed2d14ad --- .../mediawiki.action.edit.stash.js | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js index 29c533d89a..8e7b168cbd 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js @@ -11,22 +11,6 @@ data = {}, timer = null; - function stashEdit( token ) { - data = $form.serializeObject(); - - pending = api.post( { - action: 'stashedit', - token: token, - title: mw.config.get( 'wgPageName' ), - section: data.wpSection, - sectiontitle: '', - text: data.wpTextbox1, - contentmodel: data.model, - contentformat: data.format, - baserevid: data.parentRevId - } ); - } - /* Has the edit body text changed since the last stashEdit() call? */ function isChanged() { // Normalize line endings to CRLF, like $.fn.serializeObject does. @@ -44,7 +28,17 @@ pending.abort(); } - api.getToken( 'edit' ).then( stashEdit ); + data = $form.serializeObject(); + pending = api.postWithToken( 'edit', { + action: 'stashedit', + title: mw.config.get( 'wgPageName' ), + section: data.wpSection, + sectiontitle: '', + text: data.wpTextbox1, + contentmodel: data.model, + contentformat: data.format, + baserevid: data.parentRevId + } ); } function onKeyPress( e ) { -- 2.20.1