feat(splash): load latest chat message
Docker Image / Build and Push Docker Image (push) Has been cancelled
Docker Image / Build and Push Docker Image (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { getChatRepository } from "@/data/repositories/chat_repository";
|
||||
import { Result, type Result as ResultT } from "@/utils";
|
||||
|
||||
import { getSplashLatestMessagePreview } from "./splash_latest_message_preview";
|
||||
|
||||
export async function fetchSplashLatestMessagePreview(): Promise<
|
||||
ResultT<string | null>
|
||||
> {
|
||||
const result = await getChatRepository().getHistory(1, 0);
|
||||
if (Result.isErr(result)) return Result.err(result.error);
|
||||
|
||||
const latestMessage = result.data.messages[0] ?? null;
|
||||
return Result.ok(getSplashLatestMessagePreview(latestMessage));
|
||||
}
|
||||
Reference in New Issue
Block a user