Skip to content

Commit

Permalink
Patch wikibase-edit to maxlath/wikibase-edit#63
Browse files Browse the repository at this point in the history
  • Loading branch information
diegodlh committed Mar 12, 2021
1 parent 5619443 commit fd5d1fa
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions patches/wikibase-edit+4.11.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/node_modules/wikibase-edit/lib/request/logout.js b/node_modules/wikibase-edit/lib/request/logout.js
new file mode 100644
index 0000000..1f73f38
--- /dev/null
+++ b/node_modules/wikibase-edit/lib/request/logout.js
@@ -0,0 +1,17 @@
+const request = require('./request')
+const { buildUrl } = require('../utils')
+
+module.exports = (instance, token) => () => {
+ request('post', {
+ url: buildUrl(
+ `${instance}/w/api.php`, {
+ action: 'logout',
+ format: 'json'
+ }
+ ),
+ headers: {},
+ body: {
+ token: token
+ }
+ });
+}
diff --git a/node_modules/wikibase-edit/lib/request/post.js b/node_modules/wikibase-edit/lib/request/post.js
index 0af9984..dab241c 100644
--- a/node_modules/wikibase-edit/lib/request/post.js
+++ b/node_modules/wikibase-edit/lib/request/post.js
@@ -1,4 +1,5 @@
const { buildUrl } = require('../utils')
+const logout = require('./logout')
const request = require('./request')
const throwErrorRes = require('./throw_error_res')

@@ -63,6 +64,7 @@ const actionPost = (action, data, config) => authData => {

return request('post', params)
.then(throwErrorRes(`action=${action} error`, params))
+ .then(logout(instance, data.token))
}

const mayBeSolvedByTokenRefresh = err => {

0 comments on commit fd5d1fa

Please sign in to comment.