18 lines
257 B
JavaScript
18 lines
257 B
JavaScript
import { fetchData } from '@/utils/api'
|
|
|
|
let homeData = {}
|
|
let cached = false
|
|
|
|
export async function getHomeData() {
|
|
if (cached) {
|
|
return homeData
|
|
} else {
|
|
const data = await fetchData('getHome')
|
|
|
|
homeData = data
|
|
cached = true
|
|
|
|
return data
|
|
}
|
|
}
|