misc_pterodactyl-panel/resources/assets/scripts/store/modules/socket.ts

31 lines
778 B
TypeScript
Raw Normal View History

2018-12-16 23:29:44 +00:00
import Status from '../../helpers/statuses';
2018-12-17 02:57:34 +00:00
import {SocketState} from "../types";
export default {
namespaced: true,
state: {
connected: false,
2018-08-07 04:33:43 +00:00
connectionError: false,
status: Status.STATUS_OFF,
},
mutations: {
2018-12-16 23:29:44 +00:00
SOCKET_CONNECT: (state: SocketState) => {
state.connected = true;
2018-08-07 04:33:43 +00:00
state.connectionError = false;
},
2019-02-10 05:15:45 +00:00
SOCKET_ERROR: (state: SocketState, err: Error) => {
2018-08-07 04:33:43 +00:00
state.connected = false;
state.connectionError = err;
},
'SOCKET_INITIAL STATUS': (state: SocketState, data: string) => {
state.status = data;
},
SOCKET_STATUS: (state: SocketState, data: string) => {
state.status = data;
}
},
};