2021-03-01 21:32:35 +00:00
|
|
|
import { fetchData } from '@/utils/api'
|
2020-09-21 17:12:14 +00:00
|
|
|
|
|
|
|
let homeData = {}
|
|
|
|
let cached = false
|
|
|
|
|
2021-03-01 21:32:35 +00:00
|
|
|
export async function getHomeData() {
|
2020-09-21 17:12:14 +00:00
|
|
|
if (cached) {
|
|
|
|
return homeData
|
|
|
|
} else {
|
2021-03-01 21:32:35 +00:00
|
|
|
const data = await fetchData('getHome')
|
2020-09-21 17:12:14 +00:00
|
|
|
|
2021-03-01 21:32:35 +00:00
|
|
|
homeData = data
|
|
|
|
cached = true
|
2020-09-21 17:12:14 +00:00
|
|
|
|
2021-03-01 21:32:35 +00:00
|
|
|
return data
|
2020-09-21 17:12:14 +00:00
|
|
|
}
|
|
|
|
}
|