feat(frontend): single-person mode in +page.server.ts load function
Loads documents whenever senderId is set, using the optional receiverId param to switch between single-person and bilateral query modes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,14 +16,14 @@ export async function load({ url, fetch }) {
|
|||||||
|
|
||||||
const requests: Promise<void>[] = [];
|
const requests: Promise<void>[] = [];
|
||||||
|
|
||||||
if (senderId && receiverId) {
|
if (senderId) {
|
||||||
requests.push(
|
requests.push(
|
||||||
api
|
api
|
||||||
.GET('/api/documents/conversation', {
|
.GET('/api/documents/conversation', {
|
||||||
params: {
|
params: {
|
||||||
query: {
|
query: {
|
||||||
senderId,
|
senderId,
|
||||||
receiverId,
|
receiverId: receiverId || undefined,
|
||||||
dir,
|
dir,
|
||||||
from: from || undefined,
|
from: from || undefined,
|
||||||
to: to || undefined
|
to: to || undefined
|
||||||
@@ -34,9 +34,7 @@ export async function load({ url, fetch }) {
|
|||||||
documents = data ?? [];
|
documents = data ?? [];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (senderId) {
|
|
||||||
requests.push(
|
requests.push(
|
||||||
api.GET('/api/persons/{id}', { params: { path: { id: senderId } } }).then(({ data }) => {
|
api.GET('/api/persons/{id}', { params: { path: { id: senderId } } }).then(({ data }) => {
|
||||||
const p = data as { firstName: string; lastName: string } | undefined;
|
const p = data as { firstName: string; lastName: string } | undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user