Skip to content

Commit

Permalink
fix org visit bug (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendi authored Oct 23, 2024
1 parent f0cc626 commit 926fc87
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontend/src/components/organizations/OrganizationDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { ref, onMounted, watch } from 'vue'
import InviteMember from './InviteMember.vue'
import ProfileRepoList from '../shared/ProfileRepoList.vue'
import { useCookies } from 'vue3-cookies'
import useFetchApi from '../../packs/useFetchApi'
import { ElMessage } from 'element-plus'
import useUserStore from '../../stores/UserStore'
const props = defineProps({
name: String
Expand All @@ -127,6 +128,8 @@
const { cookies } = useCookies()
const userStore = useUserStore()
const role = ref('')
const fetchOrgDetail = async () => {
Expand Down Expand Up @@ -154,7 +157,7 @@
}
}
const currentUserRole = async () => {
const orgIsAdminEndpoint = `/organization/${props.name}/members/${cookies.get('current_user')}`
const orgIsAdminEndpoint = `/organization/${props.name}/members/${userStore.username}`
const { data, error } = await useFetchApi(orgIsAdminEndpoint).json()
if (error.value) {
ElMessage({ message: error.value.msg, type: 'warning' })
Expand All @@ -164,9 +167,12 @@
}
}
watch(() => userStore.username, () => {
currentUserRole()
})
onMounted(() => {
fetchOrgDetail()
fetchOrgMemberList()
currentUserRole()
})
</script>

0 comments on commit 926fc87

Please sign in to comment.