diff --git a/client/src/components/RoomsCreate.vue b/client/src/components/RoomsCreate.vue
index d686491..c281cd5 100644
--- a/client/src/components/RoomsCreate.vue
+++ b/client/src/components/RoomsCreate.vue
@@ -524,13 +524,21 @@
Close
Create
+
+ Create and start
+
@@ -574,6 +582,7 @@ export default class RoomsCreate extends Vue {
public browserPolicyEnabled = false
public loading = false
+ public loadingWithStart = false
public data: RoomSettings = { ...this.$store.state.defaultRoomSettings }
public browserPolicyContent: BrowserPolicyContent = { ...this.$store.state.defaultBrowserPolicyContent }
public envList: { key: string; val: string }[] = []
@@ -704,7 +713,16 @@ export default class RoomsCreate extends Vue {
Vue.delete(this.envList, index)
}
- async Create() {
+ async CreateAndStart() {
+ this.loadingWithStart = true
+ try {
+ await this.Create(true)
+ } finally {
+ this.loadingWithStart = false
+ }
+ }
+
+ async Create(start = false) {
const valid = this._form.validate()
if (!valid) return
@@ -713,7 +731,7 @@ export default class RoomsCreate extends Vue {
try {
const envs = this.envList.reduce((obj, { key, val }) => ({ ...obj, [key]: val, }), {})
- await this.$store.dispatch('ROOMS_CREATE', {
+ await this.$store.dispatch(start ? 'ROOMS_CREATE_AND_START' : 'ROOMS_CREATE', {
...this.data,
// eslint-disable-next-line
user_pass: this.data.user_pass || randomPassword(),
diff --git a/client/src/components/RoomsQuick.vue b/client/src/components/RoomsQuick.vue
index 924f479..aa8690c 100644
--- a/client/src/components/RoomsQuick.vue
+++ b/client/src/components/RoomsQuick.vue
@@ -70,7 +70,7 @@ export default class RoomActionBtn extends Vue {
this.loading = true
try {
- const entry = await this.$store.dispatch('ROOMS_CREATE', {
+ const entry = await this.$store.dispatch('ROOMS_CREATE_AND_START', {
...this.$store.state.defaultRoomSettings,
// eslint-disable-next-line
neko_image,
diff --git a/client/src/store/index.ts b/client/src/store/index.ts
index 7b59b0f..20abbd9 100644
--- a/client/src/store/index.ts
+++ b/client/src/store/index.ts
@@ -85,6 +85,11 @@ export default new Vuex.Store({
commit('ROOMS_SET', res.data);
},
async ROOMS_CREATE({ commit }: ActionContext, roomSettings: RoomSettings): Promise {
+ const res = await roomsApi.roomCreate(false, roomSettings)
+ commit('ROOMS_ADD', res.data);
+ return res.data
+ },
+ async ROOMS_CREATE_AND_START({ commit }: ActionContext, roomSettings: RoomSettings): Promise {
const res = await roomsApi.roomCreate(true, roomSettings)
commit('ROOMS_ADD', res.data);
return res.data