echoes/frontend/services/dependency-checker.ts

29 lines
800 B
TypeScript
Raw Normal View History

// services/dependency-checker.ts
import { Dependency } from "../types/common";
/**
*
*/
export class DependencyChecker {
/**
*
* @param dependencies
* @returns
*/
static async checkDependencies(dependencies: Dependency[]): Promise<boolean> {
for (const dep of dependencies) {
const response = await fetch(`/api/dependencies/check`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(dep)
});
if (!response.ok) {
console.error(`依赖检查失败: ${dep.id}`);
return false;
}
}
return true;
}
}