feat: changes
This commit is contained in:
38
server/utils/nocodb.ts
Normal file
38
server/utils/nocodb.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
export interface PageInfo {
|
||||
pageSize: number;
|
||||
totalRows: number;
|
||||
isFirstPage: boolean;
|
||||
isLastPage: boolean;
|
||||
page: number;
|
||||
}
|
||||
|
||||
export interface InterestsResponse {
|
||||
list: Interest[];
|
||||
PageInfo: PageInfo;
|
||||
}
|
||||
|
||||
export enum Table {
|
||||
Interest = "mbs9hjauug4eseo",
|
||||
}
|
||||
|
||||
export const getNocoDbConfiguration = () => useRuntimeConfig().nocodb;
|
||||
|
||||
export const createTableUrl = (table: Table) =>
|
||||
`${getNocoDbConfiguration().url}/api/v2/tables/${table}/records`;
|
||||
|
||||
export const getInterests = async () =>
|
||||
$fetch<InterestsResponse>(createTableUrl(Table.Interest), {
|
||||
headers: {
|
||||
"xc-token": getNocoDbConfiguration().token,
|
||||
},
|
||||
params: {
|
||||
limit: 1000,
|
||||
},
|
||||
});
|
||||
|
||||
export const getInterestById = async (id: string) =>
|
||||
$fetch<Interest>(`${createTableUrl(Table.Interest)}/${id}`, {
|
||||
headers: {
|
||||
"xc-token": getNocoDbConfiguration().token,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user