2016-11-29 09:33:14 +08:00
|
|
|
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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-29 09:33:14 +08:00
|
|
|
accessTokenForAccountId = (aid) => {
|
2016-12-02 05:34:39 +08:00
|
|
|
return AccountStore.tokensForAccountId(aid).n1Cloud
|
2016-11-29 07:38:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new N1CloudAPI();
|