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,26 @@
import webClient from '../../WebClient';
import { SessionPersistence } from '../../persistence';
export function listUsers(): void {
const CmdListUsers = webClient.protobuf.controller.Command_ListUsers.create();
const sc = webClient.protobuf.controller.SessionCommand.create({
'.Command_ListUsers.ext': CmdListUsers
});
webClient.protobuf.sendSessionCommand(sc, raw => {
const { responseCode } = raw;
const response = raw['.Response_ListUsers.ext'];
if (response) {
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
SessionPersistence.updateUsers(response.userList);
break;
default:
console.log(`Failed to fetch Server Rooms [${responseCode}] : `, raw);
}
}
});
}