Files
yunzerwebsiteallinone/uniapp/api/workspace.js
T
2026-11-16 17:22:50 +08:00

42 lines
730 B
JavaScript

import { request } from '@/api/request.js'
const CACHE_TTL = 30 * 1000
let cache = null
let cacheAt = 0
export async function fetchHome(force = false) {
if (!force && cache && Date.now() - cacheAt < CACHE_TTL) return cache
const data = await request({
url: '/api/home',
method: 'GET',
silent: true,
timeout: 15000
})
cache = data
cacheAt = Date.now()
return data
}
export function clearHomeCache() {
cache = null
cacheAt = 0
}
export function fetchPublicModules() {
return request({
url: '/api/modules/public',
method: 'GET',
silent: true,
timeout: 15000
})
}
export function fetchPublicMenus() {
return request({
url: '/api/menus/public',
method: 'GET',
silent: true,
timeout: 15000
})
}