mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
move and rename src/websocket/instanceServices to src/api (#4360)
Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
66d24f086e
commit
5cf9023a21
16 changed files with 19 additions and 30 deletions
23
webclient/src/api/AuthenticationService.tsx
Normal file
23
webclient/src/api/AuthenticationService.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { StatusEnum } from "types";
|
||||
import { webClient } from "websocket";
|
||||
|
||||
export default class AuthenticationService {
|
||||
static connect(options) {
|
||||
webClient.services.session.connectServer(options);
|
||||
}
|
||||
static disconnect() {
|
||||
webClient.services.session.disconnectServer();
|
||||
}
|
||||
|
||||
static isConnected(state) {
|
||||
return state === StatusEnum.LOGGEDIN;
|
||||
}
|
||||
|
||||
static isModerator(user) {
|
||||
return user.userLevel >= webClient.pb.ServerInfo_User.UserLevelFlag.IsModerator;
|
||||
}
|
||||
|
||||
static isAdmin() {
|
||||
|
||||
}
|
||||
}
|
||||
7
webclient/src/api/ModeratorService.tsx
Normal file
7
webclient/src/api/ModeratorService.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { webClient } from "websocket";
|
||||
|
||||
export default class ModeratorService {
|
||||
static viewLogHistory(filters) {
|
||||
webClient.commands.session.viewLogHistory(filters);
|
||||
}
|
||||
}
|
||||
11
webclient/src/api/RoomsService.tsx
Normal file
11
webclient/src/api/RoomsService.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { webClient } from "websocket";
|
||||
|
||||
export default class RoomsService {
|
||||
static joinRoom(roomId) {
|
||||
webClient.commands.session.joinRoom(roomId);
|
||||
}
|
||||
|
||||
static roomSay(roomId, message) {
|
||||
webClient.commands.room.roomSay(roomId, message);
|
||||
}
|
||||
}
|
||||
7
webclient/src/api/RouterService.tsx
Normal file
7
webclient/src/api/RouterService.tsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { RouteEnum } from "types";
|
||||
|
||||
export class RouterService {
|
||||
resolveUrl(path, params) {
|
||||
|
||||
}
|
||||
}
|
||||
19
webclient/src/api/SessionService.tsx
Normal file
19
webclient/src/api/SessionService.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { webClient } from "websocket";
|
||||
|
||||
export default class SessionService {
|
||||
static addToBuddyList(userName) {
|
||||
webClient.commands.session.addToBuddyList(userName);
|
||||
}
|
||||
|
||||
static removeFromBuddyList(userName) {
|
||||
webClient.commands.session.removeFromBuddyList(userName);
|
||||
}
|
||||
|
||||
static addToIgnoreList(userName) {
|
||||
webClient.commands.session.addToIgnoreList(userName);
|
||||
}
|
||||
|
||||
static removeFromIgnoreList(userName) {
|
||||
webClient.commands.session.removeFromIgnoreList(userName);
|
||||
}
|
||||
}
|
||||
4
webclient/src/api/index.ts
Normal file
4
webclient/src/api/index.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export { default as AuthenticationService } from "./AuthenticationService";
|
||||
export { default as ModeratorService } from "./ModeratorService";
|
||||
export { default as RoomsService } from "./RoomsService";
|
||||
export { default as SessionService } from "./SessionService";
|
||||
Loading…
Add table
Add a link
Reference in a new issue