mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
More web stuff (#5055)
* Add Response.gamesOfuser * Cleanup and confirm all
This commit is contained in:
parent
f04702fdd1
commit
291c535edb
12 changed files with 71 additions and 24 deletions
29
webclient/src/websocket/commands/session/getGamesOfUser.ts
Normal file
29
webclient/src/websocket/commands/session/getGamesOfUser.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function getGamesOfUser(userName: string): void {
|
||||
const command = webClient.protobuf.controller.Command_GetGamesOfUser.create({ userName });
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_GetGamesOfUser.ext': command
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
const response = raw['.Response_GetGamesOfUser.ext'];
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.getGamesOfUser(userName, response);
|
||||
break;
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespFunctionNotAllowed:
|
||||
console.log('Not allowed');
|
||||
break;
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespWrongPassword:
|
||||
console.log('Wrong password');
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to update information');
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue