mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-23 00:36:50 +08:00
26 lines
636 B
JavaScript
26 lines
636 B
JavaScript
import {AccountStore} from 'nylas-exports'
|
|
|
|
class N1CloudAPI {
|
|
constructor() {
|
|
NylasEnv.config.onDidChange('env', this._onConfigChanged);
|
|
this._onConfigChanged();
|
|
}
|
|
|
|
_onConfigChanged = () => {
|
|
const env = NylasEnv.config.get('env')
|
|
if (['development', 'local'].includes(env)) {
|
|
this.APIRoot = "http://lvh.me:5100";
|
|
} else if (env === 'staging') {
|
|
this.APIRoot = "https://n1-staging.nylas.com";
|
|
} else {
|
|
this.APIRoot = "https://n1.nylas.com";
|
|
}
|
|
}
|
|
|
|
accessTokenForAccountId = (aid) => {
|
|
return AccountStore.tokensForAccountId(aid).n1Cloud
|
|
}
|
|
}
|
|
|
|
export default new N1CloudAPI();
|