import { request } from '../request';

/** get constant routes */
export function fetchGetConstantRoutes() {
  // return request<Api.Route.MenuRoute[]>({ url: '/route/getConstantRoutes' });
  return request<Api.Route.MenuRoute[]>({ url: '/api/user/getResources' });
}

/** get user routes */
export function fetchGetUserRoutes() {
  // return request<Api.Route.UserRoute>({ url: '/route/getUserRoutes' });
  return request<Api.Route.MenuRoute[]>({ url: '/smqjh-system/api/v1/menus/routes' });
}

/**
 * whether the route is exist
 *
 * @param routeName route name
 */
export function fetchIsRouteExist(routeName: string) {
  return request<boolean>({ url: '/route/isRouteExist', params: { routeName } });
}
