mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 15:19:41 +02:00
refactor(frontend): 🚧 Add group/user CRUD support for admins
This commit is contained in:
parent
917177da5b
commit
695d7e96ae
46 changed files with 2015 additions and 102 deletions
26
frontend/api/class-interfaces/groups.ts
Normal file
26
frontend/api/class-interfaces/groups.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { requests } from "../requests";
|
||||
import { BaseAPIClass } 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 BaseAPIClass<GroupInDB, CreateGroup> {
|
||||
baseRoute = routes.groups;
|
||||
itemRoute = routes.groupsId;
|
||||
/** Returns the Group Data for the Current User
|
||||
*/
|
||||
async getCurrentUserGroup() {
|
||||
return await requests.get(routes.groupsSelf);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue