first commit

This commit is contained in:
2025-04-24 13:11:28 +08:00
commit ff9c54d5e4
5960 changed files with 834111 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import useAbortController from '../../../shared/hooks/use-abort-controller'
import { fetchWordCount } from '../utils/api'
import { useEffect, useState } from 'react'
export function useWordCount(projectId, clsiServerId) {
const [loading, setLoading] = useState(true)
const [error, setError] = useState(false)
const [data, setData] = useState()
const { signal } = useAbortController()
useEffect(() => {
fetchWordCount(projectId, clsiServerId, { signal })
.then(data => {
setData(data.texcount)
})
.catch(() => {
setError(true)
})
.finally(() => {
setLoading(false)
})
}, [signal, clsiServerId, projectId])
return { data, error, loading }
}