13 lines
464 B
TypeScript
13 lines
464 B
TypeScript
import { Params } from "react-router";
|
|
import { useMatches } from "react-router";
|
|
import UrlUtils from "../app/UrlUtils";
|
|
import { TenantUserWithUser } from "../db/tenants.db.server";
|
|
|
|
export type MembersLoaderData = {
|
|
users: TenantUserWithUser[];
|
|
};
|
|
|
|
export function useMembersData(params: Params): MembersLoaderData {
|
|
return (useMatches().find((f) => f.pathname === UrlUtils.currentTenantUrl(params, "settings/members"))?.data ?? {}) as MembersLoaderData;
|
|
}
|