Compare commits
2 Commits
25be3947a6
...
036b97f8e4
Author | SHA1 | Date |
---|---|---|
Tim Gröger | 036b97f8e4 | |
Tim Gröger | 775da10b3b |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0-alpha.4",
|
||||
"version": "1.0.0-alpha.5",
|
||||
"name": "@flaschengeist/users",
|
||||
"author": "Ferdinand Thiessen <rpm@fthiessen.de>",
|
||||
"homepage": "https://flaschengeist.dev/Flaschengeist",
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { Screen } from 'quasar';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { onBeforeMount, watch } from 'vue';
|
||||
import { PERMISSIONS } from '../permissions';
|
||||
import NewUser from '../components/NewUser.vue';
|
||||
import { hasPermission } from '@flaschengeist/api';
|
||||
|
@ -57,6 +59,8 @@ export default defineComponent({
|
|||
components: { RoleSettings, UpdateUser, NewUser },
|
||||
setup() {
|
||||
const canEditRoles = computed(() => hasPermission(PERMISSIONS.ROLES_EDIT));
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
interface Tab {
|
||||
name: string;
|
||||
|
@ -74,6 +78,16 @@ export default defineComponent({
|
|||
{ name: 'roles', label: 'Rollen', permissions: [PERMISSIONS.ROLES_EDIT] },
|
||||
];
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (
|
||||
route.query.keys?.length === 0 ||
|
||||
!tabs.some((value) => value.name == route.query.q_tab)
|
||||
) {
|
||||
await router.replace({ query: { q_tab: 'user' } });
|
||||
}
|
||||
tab.value = route.query.q_tab as string;
|
||||
});
|
||||
|
||||
const _tabs = computed(() =>
|
||||
tabs.filter((tab) => {
|
||||
return tab.permissions.every((permission) => hasPermission(permission));
|
||||
|
@ -93,6 +107,10 @@ export default defineComponent({
|
|||
|
||||
const tab = ref<string>('user');
|
||||
|
||||
watch(tab, async (val) => {
|
||||
await router.replace({ query: { q_tab: val } });
|
||||
});
|
||||
|
||||
return {
|
||||
canEditRoles,
|
||||
showDrawer,
|
||||
|
|
Loading…
Reference in New Issue