Mailspring/packages/client-app/src/n1-cloud-api.es6

26 lines
636 B
Plaintext
Raw Normal View History

import {AccountStore} from 'nylas-exports'
2016-11-29 07:38:53 +08:00
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";
2016-11-29 07:38:53 +08:00
} else {
this.APIRoot = "https://n1.nylas.com";
}
}
accessTokenForAccountId = (aid) => {
return AccountStore.tokensForAccountId(aid).n1Cloud
2016-11-29 07:38:53 +08:00
}
}
export default new N1CloudAPI();