import { axiosInstance } from "./service"; import { ENDPOINT_VERSION } from "./const"; import { endpoint as ENDPOINT } from "./service"; export const createKey = async ( projectId: string | number, entropy?: string ) => { try { const data = { projectId: projectId.toString(), entropy, }; const config = { method: "post", url: `${ENDPOINT}project-service/${ENDPOINT_VERSION}/project-keys`, data, }; return axiosInstance(config); } catch (error) { console.error(error); } }; export const getKeyList = async ( page?: number, pageSize?: number, sortBy?: string ) => { try { const _page = page || 1; const _pageSize = pageSize || 5; const _sortBy = sortBy || "createdAt:desc"; const config = { method: "get", url: `${ENDPOINT}project-service/${ENDPOINT_VERSION}/project-keys?page=${_page}&limit=${_pageSize}&sortBy=${_sortBy}`, }; return axiosInstance(config); } catch (error) { console.error(error); } }; export const deleteKey = async (listKeySelected: Array) => { try { const data = { ids: listKeySelected, }; const config = { method: "delete", url: `${ENDPOINT}project-service/${ENDPOINT_VERSION}/project-keys`, data, }; return axiosInstance(config); } catch (error) { console.error(error); } };