WebClient: refactor protobuf method structure (#5014)

This commit is contained in:
Jeremy Letto 2024-04-01 12:32:08 -05:00 committed by GitHub
parent f174614496
commit be5d42baba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 1014 additions and 1263 deletions

View file

@ -0,0 +1,30 @@
import webClient from '../../WebClient';
import { SessionPersistence } from '../../persistence';
export function viewLogHistory(filters): void {
const CmdViewLogHistory = webClient.protobuf.controller.Command_ViewLogHistory.create(filters);
const sc = webClient.protobuf.controller.ModeratorCommand.create({
'.Command_ViewLogHistory.ext': CmdViewLogHistory
});
webClient.protobuf.sendModeratorCommand(sc, (raw) => {
const { responseCode } = raw;
let error;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
const { logMessage } = raw['.Response_ViewLogHistory.ext'];
SessionPersistence.viewLogs(logMessage)
return;
default:
error = 'Failed to retrieve log history.';
break;
}
if (error) {
console.error(responseCode, error);
}
});
}