MCPcopy Create free account
hub / github.com/chokcoco/iCSS / testAPIs

Function testAPIs

website/app/test-api/page.tsx:36–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35 useEffect(() => {
36 const testAPIs = async () => {
37 try {
38 setLoading(true);
39 setError(null);
40
41 // 测试文章 API
42 const articlesRes = await fetch('/api/articles');
43 const articlesData = await articlesRes.json();
44 setArticles(articlesData);
45
46 // 测试分类 API
47 const categoriesRes = await fetch('/api/categories');
48 const categoriesData = await categoriesRes.json();
49 setCategories(categoriesData);
50
51 } catch (err) {
52 setError(err instanceof Error ? err.message : '未知错误');
53 } finally {
54 setLoading(false);
55 }
56 };
57
58 testAPIs();
59 }, []);

Callers 1

TestAPIPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected