mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
migrate to Protobuf ES
This commit is contained in:
parent
68e22d22bf
commit
fd55f4fb7f
133 changed files with 1745 additions and 1621 deletions
|
|
@ -1,23 +1,25 @@
|
|||
import { AccountActivationParams } from 'store';
|
||||
import { StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import { create } from '@bufbuild/protobuf';
|
||||
import webClient from '../../WebClient';
|
||||
import { BackendService } from '../../services/BackendService';
|
||||
import { ProtoController } from '../../services/ProtoController';
|
||||
import { Command_Activate_ext, Command_ActivateSchema } from 'generated/proto/session_commands_pb';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
import { Response_ResponseCode } from 'generated/proto/response_pb';
|
||||
|
||||
import { disconnect, login, updateStatus } from './';
|
||||
|
||||
export function activate(options: WebSocketConnectOptions, password?: string, passwordSalt?: string): void {
|
||||
const { userName, token } = options as unknown as AccountActivationParams;
|
||||
|
||||
BackendService.sendSessionCommand('Command_Activate', {
|
||||
BackendService.sendSessionCommand(Command_Activate_ext, create(Command_ActivateSchema, {
|
||||
...webClient.clientConfig,
|
||||
userName,
|
||||
token,
|
||||
}, {
|
||||
}), {
|
||||
onResponseCode: {
|
||||
[ProtoController.root.Response.ResponseCode.RespActivationAccepted]: () => {
|
||||
[Response_ResponseCode.RespActivationAccepted]: () => {
|
||||
SessionPersistence.accountActivationSuccess();
|
||||
login(options, password, passwordSalt);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue