mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-08-07 06:15:13 +03:00
feat: actualize system actions behavior
This commit is contained in:
29
fe-app-podkop/src/podkop/fetchers/fetchServicesInfo.ts
Normal file
29
fe-app-podkop/src/podkop/fetchers/fetchServicesInfo.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { PodkopShellMethods } from '../methods';
|
||||
import { store } from '../services';
|
||||
|
||||
export async function fetchServicesInfo() {
|
||||
const [podkop, singbox] = await Promise.all([
|
||||
PodkopShellMethods.getStatus(),
|
||||
PodkopShellMethods.getSingBoxStatus(),
|
||||
]);
|
||||
|
||||
if (!podkop.success || !singbox.success) {
|
||||
store.set({
|
||||
servicesInfoWidget: {
|
||||
loading: false,
|
||||
failed: true,
|
||||
data: { singbox: 0, podkop: 0 },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (podkop.success && singbox.success) {
|
||||
store.set({
|
||||
servicesInfoWidget: {
|
||||
loading: false,
|
||||
failed: false,
|
||||
data: { singbox: singbox.data.running, podkop: podkop.data.enabled },
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user