system.ts 771 B

1234567891011121314151617181920
  1. import { cache } from 'react';
  2. import { ResultDto } from '@/types/response/common';
  3. import { fetchJson } from '@/lib/utils/server';
  4. import Config, { NavMenuLink } from '@/types/config';
  5. // Config 값 조회
  6. export const fetchConfig = cache(async (): Promise<ResultDto<Config|null>> => {
  7. return await fetchJson<Config>('/api/config', {
  8. method: 'GET',
  9. headers: {'Content-Type': 'application/json'},
  10. });
  11. });
  12. // 관리자 관리형 상단 메뉴 조회 (노출 항목만 정렬순)
  13. export const fetchNavMenu = cache(async (): Promise<ResultDto<{ items: NavMenuLink[] }|null>> => {
  14. return await fetchJson<{ items: NavMenuLink[] }>('/api/config/nav-menu', {
  15. method: 'GET',
  16. headers: {'Content-Type': 'application/json'},
  17. });
  18. });