|
@@ -228,16 +228,11 @@ function A1statistics() {
|
|
|
const fetch = async () => {
|
|
const fetch = async () => {
|
|
|
try {
|
|
try {
|
|
|
const res = await A1_APIgetDataTagByTagId(Number(categoryTagId))
|
|
const res = await A1_APIgetDataTagByTagId(Number(categoryTagId))
|
|
|
- if (
|
|
|
|
|
- res?.code === 0 &&
|
|
|
|
|
- res.data &&
|
|
|
|
|
- typeof res.data === 'object' &&
|
|
|
|
|
- !Array.isArray(res.data)
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if (res?.code === 0 && res.data && Array.isArray(res.data)) {
|
|
|
setCategoryData(
|
|
setCategoryData(
|
|
|
- Object.entries(res.data as Record<string, number>).map(([name, value]) => ({
|
|
|
|
|
- name,
|
|
|
|
|
- value
|
|
|
|
|
|
|
+ res.data.map(i => ({
|
|
|
|
|
+ name: i.name,
|
|
|
|
|
+ value: i.count
|
|
|
}))
|
|
}))
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|