Skip to content

Commit 301c45d

Browse files
committed
lib udpate
1 parent 85b4d62 commit 301c45d

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

package-lock.json

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"@material-ui/icons": "^4.11.2",
6666
"@tinymce/tinymce-react": "^3.9.0",
6767
"autobind-decorator": "^2.4.0",
68+
"axios": "^0.21.4",
6869
"cheerio": "^1.0.0-rc.5",
6970
"classnames": "^2.2.6",
7071
"codemirror": "^5.59.2",

src/main/oauth/ElectronOauth2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const Promise = require('pinkie-promise');
44
const queryString = require('querystring');
5-
const fetch = require('node-fetch');
5+
const axios = require('axios')
66
const objectAssign = require('object-assign');
77
const nodeUrl = require('url');
88
const { BrowserWindow } = require('electron');
@@ -111,8 +111,8 @@ module.exports = function (oauthInfo, windowParams, tokenMethod = 'POST') {
111111
fetchOptions['body'] = queryString.stringify(data);
112112
}
113113

114-
return fetch(url, fetchOptions)
115-
.then(res => res.json());
114+
return axios(url, fetchOptions)
115+
.then(res => res.data);
116116
}
117117

118118
function getAccessToken(opts) {

src/main/oauth/ExternalOAuth2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const queryString = require('querystring');
2-
const fetch = require('node-fetch');
2+
const axios = require('axios')
33
const electron = require('electron');
44
const AuthUtils = require('../lib/AuthUtils')
55

@@ -62,8 +62,8 @@ class ExternalOAuth2 {
6262
fetchOptions['body'] = queryString.stringify(tokenRequestData);
6363
}
6464

65-
return fetch(url, fetchOptions)
66-
.then(res => res.json())
65+
return axios(url, fetchOptions)
66+
.then(res => res.data)
6767
}
6868
}
6969

src/main/window.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function setWindowWebContents() {
5353

5454
mainWindow.webContents.on('will-navigate', handleRedirect)
5555
mainWindow.webContents.on('new-window', handleRedirect)
56+
require('@electron/remote/main').enable(mainWindow.webContents)
5657
}
5758

5859
function setWindowMenu() {

0 commit comments

Comments
 (0)