7699ac7139
Gitea Auto Deploy / Deploy-Container (push) Successful in 49s
- Reformatted multiple TypeScript interfaces across various files to ensure consistent spacing and indentation. - Updated `changelog.ts`, `enka.ts`, `extraData.ts`, `gloval.d.ts`, `index.ts`, `lightconeDetail.ts`, `metaData.ts`, `mics.ts`, `modelConfig.ts`, `monsterDetail.ts`, `peakDetail.ts`, `pfDetail.ts`, `psConnect.ts`, `relicDetail.ts`, `showcase.ts`, `srtools.ts`, and `zod/index.ts` for improved code clarity. - Ensured all interfaces are properly formatted with consistent line breaks and spacing. - Made minor adjustments to the `tsconfig.json` file for formatting consistency.
26 lines
789 B
TypeScript
26 lines
789 B
TypeScript
"use client"
|
|
import { useQuery } from '@tanstack/react-query'
|
|
import { getLightconeListApi } from '@/lib/api';
|
|
import { useEffect } from 'react'
|
|
import { toast } from 'react-toastify'
|
|
import useDetailDataStore from '@/stores/detailDataStore';
|
|
|
|
export const useFetchLightconeData = () => {
|
|
const { setMapLightCone } = useDetailDataStore()
|
|
const query = useQuery({
|
|
queryKey: ['lightconeData'],
|
|
queryFn: getLightconeListApi,
|
|
staleTime: 1000 * 60 * 5,
|
|
})
|
|
|
|
useEffect(() => {
|
|
if (query.data && !query.error) {
|
|
setMapLightCone(query.data)
|
|
} else if (query.error) {
|
|
toast.error("Failed to load lightcone data")
|
|
}
|
|
}, [query.data, query.error, setMapLightCone])
|
|
|
|
return query
|
|
}
|