51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
import type {
|
|
MenuAuthorityList,
|
|
MenuAuthorityParams,
|
|
MenuAuthorityPayload,
|
|
MenuAuthorityService,
|
|
PageMenuAuthority,
|
|
} from "../model/menu-authority-interface";
|
|
|
|
export class MenuAuthorityApiService implements MenuAuthorityService {
|
|
public async getMenuAuthorityList(
|
|
params: MenuAuthorityParams,
|
|
): Promise<MenuAuthorityList> {
|
|
const response = await client.get<MenuAuthorityList>(
|
|
`${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getPageMenuAuthority(
|
|
menuCd: number,
|
|
): Promise<PageMenuAuthority[]> {
|
|
const response = await client.get<PageMenuAuthority[]>(
|
|
`${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}/pageinfo/${menuCd}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async saveMenuAuthority(data: MenuAuthorityPayload[]): Promise<void> {
|
|
const response = await client.post<void>(
|
|
`${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}`,
|
|
data,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getGroupMenuAuthorityList(
|
|
params: MenuAuthorityParams,
|
|
): Promise<MenuAuthorityList> {
|
|
const response = await client.get<MenuAuthorityList>(
|
|
`${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}/group`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
}
|
|
|
|
export const MenuAuthorityApi = new MenuAuthorityApiService();
|