snappymail/dev/Stores/Admin/Plugin.js
2021-03-18 14:48:21 +01:00

24 lines
565 B
JavaScript

import ko from 'ko';
import Remote from 'Remote/Admin/Fetch';
export const PluginAdminStore = ko.observableArray();
PluginAdminStore.loading = ko.observable(false);
PluginAdminStore.error = ko.observable('');
PluginAdminStore.fetch = () => {
PluginAdminStore.loading(true);
Remote.pluginList((iError, data) => {
PluginAdminStore.loading(false);
if (!iError) {
PluginAdminStore(
data.Result.map(item => ({
name: item.Name,
disabled: ko.observable(!item.Enabled),
configured: ko.observable(!!item.Configured)
}))
);
}
});
};