Cleanup socketio stuff for typescript
This commit is contained in:
parent
3ad4422a94
commit
5e4ca8ef83
22 changed files with 246 additions and 210 deletions
|
@ -1,20 +1,14 @@
|
|||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import auth, {AuthenticationState} from './modules/auth';
|
||||
import dashboard, {DashboardState} from './modules/dashboard';
|
||||
import server, {ServerState} from './modules/server';
|
||||
import socket, {SocketState} from './modules/socket';
|
||||
import auth from './modules/auth';
|
||||
import dashboard from './modules/dashboard';
|
||||
import server from './modules/server';
|
||||
import socket from './modules/socket';
|
||||
import {ApplicationState} from "./types";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
export type ApplicationState = {
|
||||
socket: SocketState,
|
||||
server: ServerState,
|
||||
auth: AuthenticationState,
|
||||
dashboard: DashboardState,
|
||||
}
|
||||
|
||||
const store = new Vuex.Store({
|
||||
const store = new Vuex.Store<ApplicationState>({
|
||||
strict: process.env.NODE_ENV !== 'production',
|
||||
modules: {auth, dashboard, server, socket},
|
||||
});
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
import User, {UserData} from '../../models/user';
|
||||
import {ActionContext} from "vuex";
|
||||
import {AuthenticationState} from "../types";
|
||||
|
||||
const route = require('./../../../../../vendor/tightenco/ziggy/src/js/route').default;
|
||||
|
||||
type LoginAction = {
|
||||
type: 'login',
|
||||
user: string,
|
||||
password: string,
|
||||
}
|
||||
|
||||
type UpdateEmailAction = {
|
||||
type: 'updateEmail',
|
||||
email: string,
|
||||
password: string,
|
||||
}
|
||||
|
||||
export type AuthenticationState = {
|
||||
user: null | User,
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
import Server, {ServerData} from '../../models/server';
|
||||
import {ActionContext} from "vuex";
|
||||
import {DashboardState} from "../types";
|
||||
const route = require('./../../../../../vendor/tightenco/ziggy/src/js/route').default;
|
||||
|
||||
export type DashboardState = {
|
||||
searchTerm: string,
|
||||
servers: Array<Server>,
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
|
|
|
@ -2,17 +2,7 @@
|
|||
import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
|
||||
import {ActionContext} from "vuex";
|
||||
import {ServerData} from "../../models/server";
|
||||
|
||||
type ServerApplicationCredentials = {
|
||||
node: string,
|
||||
key: string,
|
||||
};
|
||||
|
||||
export type ServerState = {
|
||||
server: ServerData,
|
||||
credentials: ServerApplicationCredentials,
|
||||
console: Array<string>,
|
||||
};
|
||||
import {ServerApplicationCredentials, ServerState} from "../types";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import Status from '../../helpers/statuses';
|
||||
|
||||
export type SocketState = {
|
||||
connected: boolean,
|
||||
connectionError: boolean | Error,
|
||||
status: number,
|
||||
}
|
||||
import {SocketState} from "../types";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
|
37
resources/assets/scripts/store/types.ts
Normal file
37
resources/assets/scripts/store/types.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import {ServerData} from "../models/server";
|
||||
import Server from "../models/server";
|
||||
import User from "../models/user";
|
||||
|
||||
export type ApplicationState = {
|
||||
socket: SocketState,
|
||||
server: ServerState,
|
||||
auth: AuthenticationState,
|
||||
dashboard: DashboardState,
|
||||
}
|
||||
|
||||
export type SocketState = {
|
||||
connected: boolean,
|
||||
connectionError: boolean | Error,
|
||||
status: number,
|
||||
}
|
||||
|
||||
export type ServerApplicationCredentials = {
|
||||
node: string,
|
||||
key: string,
|
||||
};
|
||||
|
||||
export type ServerState = {
|
||||
server: ServerData,
|
||||
credentials: ServerApplicationCredentials,
|
||||
console: Array<string>,
|
||||
};
|
||||
|
||||
export type DashboardState = {
|
||||
searchTerm: string,
|
||||
servers: Array<Server>,
|
||||
};
|
||||
|
||||
|
||||
export type AuthenticationState = {
|
||||
user: null | User,
|
||||
}
|
Reference in a new issue