Files
podkop/fe-app-podkop/src/podkop/fetchers/fetchServicesInfo.ts
2025-10-15 21:13:52 +03:00

30 lines
698 B
TypeScript

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 },
},
});
}
}