From 5cbb090bf83984038fc52f317cd8568e977cb1bd Mon Sep 17 00:00:00 2001 From: dora <31735614+dora1998@users.noreply.github.com> Date: Wed, 29 Jul 2020 18:56:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?controlState=E3=81=A7STOP=E3=82=92=E9=80=81?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v3/session.ts | 3 ++- store/pages/sessions/detail.ts | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api/v3/session.ts b/api/v3/session.ts index d310c727..2ba51fd0 100644 --- a/api/v3/session.ts +++ b/api/v3/session.ts @@ -36,8 +36,9 @@ export const controlState = async ( await instance.put(`/sessions/${sessionId}/state`, req) } +export type PlaybackStates = 'PLAY' | 'PAUSE' | 'STOP' | 'ARCHIVED' interface ControlStateRequest { - state: 'PLAY' | 'PAUSE' | 'ARCHIVED' + state: PlaybackStates } export const enqueue = async (id: string, req: EnqueueReq) => { diff --git a/store/pages/sessions/detail.ts b/store/pages/sessions/detail.ts index 64479f0a..9e441451 100644 --- a/store/pages/sessions/detail.ts +++ b/store/pages/sessions/detail.ts @@ -4,7 +4,8 @@ import { getDevices, controlState, getSession, - setDevice + setDevice, + PlaybackStates } from '@/api/v3/session' import { createWebSocket } from '@/api/v3/websocket' @@ -227,10 +228,7 @@ export const actions: ActionTree = { commit('setWebSocket', null) dispatch('reconnectWebSocket') }, - controlState: async ( - { state, dispatch }, - req: { state: 'PLAY' | 'PAUSE' } - ) => { + controlState: async ({ state, dispatch }, req: { state: PlaybackStates }) => { if (!state.sessionId) return try { await controlState(state.sessionId, req) From ad59456f3cc1510b5602bbaf1eade1c8394ce47d Mon Sep 17 00:00:00 2001 From: dora <31735614+dora1998@users.noreply.github.com> Date: Wed, 29 Jul 2020 18:56:49 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=83=89=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AB=E3=82=A2=E3=83=BC=E3=82=AB?= =?UTF-8?q?=E3=82=A4=E3=83=96/=E3=82=A2=E3=83=BC=E3=82=AB=E3=82=A4?= =?UTF-8?q?=E3=83=96=E8=A7=A3=E9=99=A4=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/organisms/SlideMenu.vue | 37 ++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/components/organisms/SlideMenu.vue b/components/organisms/SlideMenu.vue index 30054b6b..28497839 100644 --- a/components/organisms/SlideMenu.vue +++ b/components/organisms/SlideMenu.vue @@ -13,6 +13,23 @@ Home + + + unarchive + + + Unarchive + + + + + archive + + + Archive + + + import { Component, Emit, Prop, Vue } from 'vue-property-decorator' -import { mapState } from 'vuex' +import { mapState, mapActions, mapGetters } from 'vuex' import InviteLinkBox from '@/components/molecules/InviteLinkBox.vue' import { Session } from '@/api/v3/types' +import { PlaybackStates } from '@/api/v3/session' @Component({ components: { InviteLinkBox }, computed: { - ...mapState('pages/sessions/detail', ['sessionId', 'session']) + ...mapState('pages/sessions/detail', ['sessionId', 'session']), + ...mapGetters('pages/sessions/detail', ['isSessionArchived']) + }, + methods: { + ...mapActions('pages/sessions/detail', ['controlState']) } }) export default class extends Vue { @Prop({ default: false }) readonly value!: boolean private readonly sessionid!: string | null private readonly session!: Session | null + private readonly isSessionArchived!: boolean + + private controlState!: (req: { state: PlaybackStates }) => Promise @Emit() input(isOpen: boolean) { @@ -49,6 +74,14 @@ export default class extends Vue { // eslint-disable-next-line camelcase return this.session?.allow_to_control_by_others ?? true } + + archiveSession() { + this.controlState({ state: 'ARCHIVED' }) + } + + unarchiveSession() { + this.controlState({ state: 'STOP' }) + } } From e1508146c895359519256a9feec83d53360af4b3 Mon Sep 17 00:00:00 2001 From: dora <31735614+dora1998@users.noreply.github.com> Date: Wed, 29 Jul 2020 19:17:13 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=82=BB=E3=83=83=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E4=BD=9C=E6=88=90=E8=80=85=E3=81=A0=E3=81=91=E3=81=AB?= =?UTF-8?q?=E3=82=A2=E3=83=BC=E3=82=AB=E3=82=A4=E3=83=96/=E3=82=A2?= =?UTF-8?q?=E3=83=BC=E3=82=AB=E3=82=A4=E3=83=96=E8=A7=A3=E9=99=A4=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/organisms/SlideMenu.vue | 41 +++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/components/organisms/SlideMenu.vue b/components/organisms/SlideMenu.vue index 28497839..f249e1de 100644 --- a/components/organisms/SlideMenu.vue +++ b/components/organisms/SlideMenu.vue @@ -13,22 +13,25 @@ Home - - - unarchive - - - Unarchive - - - - - archive - - - Archive - - + + Promise