Skip to content

Commit

Permalink
fix: make useIsInCall a shared composable
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy authored and backportbot[bot] committed Nov 8, 2024
1 parent e7ed813 commit f7f2c95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/composables/useIsInCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { createSharedComposable } from '@vueuse/core'
import { computed, onBeforeMount, onBeforeUnmount, ref } from 'vue'

import { useStore } from './useStore.js'
Expand All @@ -15,7 +16,7 @@ import SessionStorage from '../services/SessionStorage.js'
*
* @return {import('vue').ComputedRef<boolean>}
*/
export function useIsInCall() {
function useIsInCallComposable() {
const store = useStore()

const sessionStorageJoinedConversation = ref(null)
Expand All @@ -40,3 +41,9 @@ export function useIsInCall() {
return sessionStorageJoinedConversation.value === store.getters.getToken() && store.getters.isInCall(store.getters.getToken())
})
}

/**
* Shared composable to check whether the user joined the call of the current token in this PHP session or not
* @return {import('vue').ComputedRef<boolean>}
*/
export const useIsInCall = createSharedComposable(useIsInCallComposable)

0 comments on commit f7f2c95

Please sign in to comment.