Mailspring/src/n1-cloud-api.es6

24 lines
550 B
Text
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://localhost:5100";
} 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();