mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 16:14:01 +08:00
fix(plugin-auth): change auth function params
This commit is contained in:
parent
f8e30513f8
commit
f3c64c3871
1 changed files with 6 additions and 6 deletions
|
@ -383,22 +383,22 @@ class NylasAPI
|
||||||
# 3. The API request to auth this account to the plugin failed. This may mean that
|
# 3. The API request to auth this account to the plugin failed. This may mean that
|
||||||
# the plugin server couldn't be reached or failed to respond properly when authing
|
# the plugin server couldn't be reached or failed to respond properly when authing
|
||||||
# the account, or that the Nylas API couldn't be reached.
|
# the account, or that the Nylas API couldn't be reached.
|
||||||
authPlugin: (plugin, account) ->
|
authPlugin: (pluginId, pluginName, account) ->
|
||||||
return @makeRequest({
|
return @makeRequest({
|
||||||
returnsModel: false,
|
returnsModel: false,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
accountId: account.id,
|
accountId: account.id,
|
||||||
path: "/auth/plugin?client_id=#{plugin.appId}"
|
path: "/auth/plugin?client_id=#{pluginId}"
|
||||||
}).then( (result) =>
|
}).then( (result) =>
|
||||||
if result.authed
|
if result.authed
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
else
|
else
|
||||||
return @_requestPluginAuth(plugin.name, account).then( -> @makeRequest({
|
return @_requestPluginAuth(pluginName, account).then( -> @makeRequest({
|
||||||
returnsModel: false,
|
returnsModel: false,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
accountId: account.id,
|
accountId: account.id,
|
||||||
path: "/auth/plugin",
|
path: "/auth/plugin",
|
||||||
body: JSON.stringify({client_id: plugin.appId}),
|
body: JSON.stringify({client_id: pluginId}),
|
||||||
json: true
|
json: true
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
@ -422,12 +422,12 @@ You can review and revoke Offline Access for plugins at any time from Preference
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
unauthPlugin: (plugin, account) ->
|
unauthPlugin: (pluginId, account) ->
|
||||||
return @makeRequest({
|
return @makeRequest({
|
||||||
returnsModel: false,
|
returnsModel: false,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
accountId: account.id,
|
accountId: account.id,
|
||||||
path: "/auth/plugin?client_id=#{plugin.appId}"
|
path: "/auth/plugin?client_id=#{pluginId}"
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = new NylasAPI()
|
module.exports = new NylasAPI()
|
||||||
|
|
Loading…
Reference in a new issue