mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Initial implementation completion and refactor
This commit is contained in:
parent
e977f123ce
commit
f0bf865646
76 changed files with 897 additions and 890 deletions
|
|
@ -1,26 +1,10 @@
|
|||
import webClient from '../../WebClient';
|
||||
import { BackendService } from '../../services/BackendService';
|
||||
import { AdminPersistence } from '../../persistence';
|
||||
|
||||
export function reloadConfig(): void {
|
||||
const command = webClient.protobuf.controller.Command_ReloadConfig.create();
|
||||
const sc = webClient.protobuf.controller.AdminCommand.create({ '.Command_ReloadConfig.ext': command });
|
||||
|
||||
webClient.protobuf.sendAdminCommand(sc, (raw) => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
let error: string;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
AdminPersistence.reloadConfig();
|
||||
return;
|
||||
default:
|
||||
error = 'Failed to reload config.';
|
||||
break;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.error(responseCode, error);
|
||||
}
|
||||
BackendService.sendAdminCommand('Command_ReloadConfig', {}, {
|
||||
onSuccess: () => {
|
||||
AdminPersistence.reloadConfig();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue