Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
import type { LoaderFunctionArgs } from "react-router";
|
||||
import type { ChatMentionType } from "@hivegrid/realtime";
|
||||
|
||||
import { loadChatContext } from "~/modules/chat/routes/chatAccess.server";
|
||||
import { CHAT_MODULE_KEY } from "~/modules/chat/routes/chatRoutePaths";
|
||||
import { loadChatMentionSuggestions } from "~/modules/chat/services/ChatMentionsService.server";
|
||||
|
||||
const TYPES = new Set<ChatMentionType>(["user", "project", "contact", "company"]);
|
||||
|
||||
export async function loader({ request, params }: LoaderFunctionArgs): Promise<Response> {
|
||||
const context = await loadChatContext({ request, params });
|
||||
const url = new URL(request.url);
|
||||
const query = (url.searchParams.get("q") ?? "").trim();
|
||||
const rawType = url.searchParams.get("type");
|
||||
const type = rawType && TYPES.has(rawType as ChatMentionType) ? (rawType as ChatMentionType) : null;
|
||||
const vm = await loadChatMentionSuggestions({
|
||||
context,
|
||||
tenantSlug: params.tenant ?? "",
|
||||
chatId: params.id ?? "",
|
||||
query,
|
||||
type,
|
||||
});
|
||||
return Response.json({ query, type, vm });
|
||||
}
|
||||
|
||||
export const handle = { moduleKey: CHAT_MODULE_KEY };
|
||||
Reference in new issue
Block a user