2015-06-22 17:33:25 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import alt from '../alt';
|
|
|
|
import ApplicationFetcher from '../fetchers/application_fetcher';
|
|
|
|
|
|
|
|
|
|
|
|
class ApplicationActions {
|
|
|
|
constructor() {
|
|
|
|
this.generateActions(
|
|
|
|
'updateApplications'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchApplication() {
|
|
|
|
ApplicationFetcher.fetch()
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateApplications(res.applications);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
2015-07-17 15:41:09 +02:00
|
|
|
console.logGlobal(err);
|
2015-06-22 17:33:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
refreshApplicationToken(applicationName) {
|
|
|
|
ApplicationFetcher.refreshToken(applicationName)
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateApplications(res.applications);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
2015-07-17 15:41:09 +02:00
|
|
|
console.logGlobal(err);
|
2015-06-22 17:33:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default alt.createActions(ApplicationActions);
|