hardlounge/client/components/Windows/NetworkEdit.vue

41 lines
889 B
Vue
Raw Normal View History

2019-02-18 04:18:32 -05:00
<template>
<NetworkForm
v-if="$store.state.currentNetworkConfig"
:handle-submit="handleSubmit"
:defaults="$store.state.currentNetworkConfig"
:disabled="disabled"
/>
2019-02-18 04:18:32 -05:00
</template>
<script>
const $ = require("jquery");
const socket = require("../../js/socket");
import NetworkForm from "../NetworkForm.vue";
2019-02-18 04:18:32 -05:00
export default {
name: "NetworkEdit",
components: {
NetworkForm,
2019-02-18 04:18:32 -05:00
},
data() {
return {
disabled: false,
2019-02-18 04:18:32 -05:00
};
},
methods: {
handleSubmit(data) {
this.disabled = true;
socket.emit("network:edit", data);
2019-02-18 04:18:32 -05:00
const sidebar = $("#sidebar");
// TODO: move networks to vuex and update state when the network info comes in
const network = this.$root.networks.find((n) => n.uuid === data.uuid);
network.name = network.channels[0].name = data.name;
2019-02-18 04:18:32 -05:00
2019-08-03 15:03:45 -04:00
sidebar.find(`.network[data-uuid="${data.uuid}"] .chan.lobby .name`).click();
2019-02-18 04:18:32 -05:00
},
},
};
</script>