mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
19 lines
723 B
TypeScript
19 lines
723 B
TypeScript
import { useReadOnlyStore } from "../partials/use-store-factory";
|
|
import { useRequests } from "../api/api-client";
|
|
import type { UserSummary } from "~/lib/api/types/user";
|
|
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
|
|
|
const store: Ref<UserSummary[]> = ref([]);
|
|
const loading = ref(false);
|
|
|
|
class GroupUserAPIReadOnly extends BaseCRUDAPIReadOnly<UserSummary> {
|
|
baseRoute = "/api/groups/members";
|
|
itemRoute = (idOrUsername: string | number) => `/groups/members/${idOrUsername}`;
|
|
}
|
|
|
|
export const useUserStore = function () {
|
|
const requests = useRequests();
|
|
const api = new GroupUserAPIReadOnly(requests);
|
|
|
|
return useReadOnlyStore<UserSummary>(store, loading, api, { orderBy: "full_name" });
|
|
};
|