Skip to content

Commit a913ee6

Browse files
committed
feat: console entry maintains state
1 parent 552eff4 commit a913ee6

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/components/widgets/ConsoleWidget.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export default class ConsoleWidget extends Mixins(UtilsMixin) {
3434
@Prop({ type: Boolean, default: false })
3535
readonly!: false
3636
37-
consoleCommand = ''
37+
get consoleCommand () {
38+
return this.$store.state.consoleCommand
39+
}
40+
41+
set consoleCommand (val: string) {
42+
this.$store.commit('setConsoleCommand', val)
43+
}
3844
3945
sendCommand (command?: string) {
4046
if (command && command.length) {

src/store/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@ Vue.use(Vuex)
1212

1313
export default new Vuex.Store<RootState>({
1414
strict: (process.env.NODE_ENV === 'development'),
15-
state: {},
15+
state: {
16+
consoleCommand: ''
17+
},
1618
modules: {
1719
config,
1820
socket,
1921
files,
2022
devicePower,
2123
version
2224
},
23-
mutations: {},
25+
mutations: {
26+
setConsoleCommand (state, payload) {
27+
state.consoleCommand = payload
28+
}
29+
},
2430
actions: {
2531
async init ({ dispatch, commit }, payload: Config) {
2632
// Should init the store, and ensure we've loaded our

src/store/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { SocketState } from './socket/types'
44
import { VersionState } from './version/types'
55

66
export interface RootState {
7+
consoleCommand: string;
78
config?: ConfigState;
89
files?: FilesState;
910
socket?: SocketState;

0 commit comments

Comments
 (0)