Skip to content

Commit

Permalink
Merge pull request #16 from wobsoriano/organization-list
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano authored Feb 1, 2024
2 parents f24e435 + bf42a21 commit 9e4bbb6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/components/OrganizationList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
import type { OrganizationListProps } from '@clerk/types'
import { ref } from 'vue'
import { useMountComponent } from '../composables/useMountComponent'
import { useClerk } from '../composables/useClerk'
const props = defineProps<OrganizationListProps>()
const el = ref<HTMLDivElement | null>(null)
const clerk = useClerk()
useMountComponent({
el,
mountFn: clerk.mountOrganizationList,
unmountFn: clerk.unmountOrganizationList,
props,
})
</script>

<template>
<div ref="el" />
</template>
4 changes: 2 additions & 2 deletions src/composables/useMountComponent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Ref } from 'vue'
import { watchPostEffect } from 'vue'
import { watchEffect } from 'vue'
import { useClerkProvide } from './useClerkProvide'

/**
Expand All @@ -24,7 +24,7 @@ export function useMountComponent({
}) {
const { isClerkLoaded } = useClerkProvide()

watchPostEffect((onInvalidate) => {
watchEffect((onInvalidate) => {
if (el.value && isClerkLoaded.value)
mountFn(el.value, props)

Expand Down

0 comments on commit 9e4bbb6

Please sign in to comment.