mealie/frontend/api/class-interfaces/groups.ts
hay-kot 9386cc320b refactor(frontend): 🚧 Migrate Dashboard to Nuxt
Add API and Functinality for Admin Dashboard. Stills needs to clean-up. See // TODO's
2021-08-07 15:12:25 -08:00

26 lines
632 B
TypeScript

import { requests } from "../requests";
import { BaseCRUDAPI } from "./_base";
import { GroupInDB } from "~/types/api-types/user";
const prefix = "/api";
const routes = {
groups: `${prefix}/groups`,
groupsSelf: `${prefix}/groups/self`,
groupsId: (id: string | number) => `${prefix}/groups/${id}`,
};
export interface CreateGroup {
name: string;
}
export class GroupAPI extends BaseCRUDAPI<GroupInDB, CreateGroup> {
baseRoute = routes.groups;
itemRoute = routes.groupsId;
/** Returns the Group Data for the Current User
*/
async getCurrentUserGroup() {
return await requests.get(routes.groupsSelf);
}
}