update nextcloud handling
This commit is contained in:
@@ -37,9 +37,23 @@ export const nextcloudApi = {
|
||||
.then((r) => r.data.data);
|
||||
},
|
||||
|
||||
getMessages(token: string): Promise<NextcloudMessage[]> {
|
||||
getMessages(
|
||||
token: string,
|
||||
options?: { lookIntoFuture?: boolean; lastKnownMessageId?: number; timeout?: number },
|
||||
signal?: AbortSignal,
|
||||
): Promise<NextcloudMessage[]> {
|
||||
const params: Record<string, any> = {};
|
||||
if (options?.lookIntoFuture) {
|
||||
params.lookIntoFuture = '1';
|
||||
params.lastKnownMessageId = options.lastKnownMessageId ?? 0;
|
||||
params.timeout = options.timeout ?? 25;
|
||||
}
|
||||
return api
|
||||
.get<ApiResponse<NextcloudMessage[]>>(`/api/nextcloud/talk/rooms/${encodeURIComponent(token)}/messages`)
|
||||
.get<ApiResponse<NextcloudMessage[]>>(`/api/nextcloud/talk/rooms/${encodeURIComponent(token)}/messages`, {
|
||||
params,
|
||||
signal,
|
||||
...(options?.lookIntoFuture && { timeout: ((options.timeout ?? 25) + 7) * 1000 }),
|
||||
})
|
||||
.then((r) => r.data.data);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user