snappymail/dev/Stores/Admin/Plugin.js

25 lines
565 B
JavaScript
Raw Normal View History

import ko from 'ko';
import Remote from 'Remote/Admin/Fetch';
2016-06-30 08:02:45 +08:00
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);
2021-03-18 21:48:21 +08:00
if (!iError) {
PluginAdminStore(
data.Result.map(item => ({
name: item.Name,
disabled: ko.observable(!item.Enabled),
configured: ko.observable(!!item.Configured)
}))
);
}
});
};