parameterise admin functions and move to store actions
This commit is contained in:
@@ -5,29 +5,12 @@
|
||||
middleware: ['auth'],
|
||||
});
|
||||
|
||||
const { $client } = useNuxtApp();
|
||||
|
||||
const store = useAppStore();
|
||||
const { notes } = storeToRefs(store); // ensure the notes list is reactive
|
||||
|
||||
onMounted(async () => {
|
||||
await store.initUser();
|
||||
})
|
||||
|
||||
async function joinUserToAccount(){
|
||||
const { data: membership } = await $client.userAccount.joinUserToAccount.useQuery();
|
||||
console.log(`added membership on current account: ${JSON.stringify(membership)}`);
|
||||
}
|
||||
|
||||
async function changeUserAccessWithinAccount(){
|
||||
const { data: membership } = await $client.userAccount.changeUserAccessWithinAccount.useQuery();
|
||||
console.log(`updated membership on current account: ${JSON.stringify(membership)}`);
|
||||
}
|
||||
|
||||
async function claimOwnershipOfAccount(){
|
||||
const { data: membership } = await $client.userAccount.claimOwnershipOfAccount.useQuery();
|
||||
console.log(`updated membership on current account: ${JSON.stringify(membership)}`);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
@@ -35,8 +18,8 @@
|
||||
<p v-for="note in notes">{{ note.note_text }}</p>
|
||||
|
||||
<button @click.prevent="store.changeAccountPlan(2)">Change Account Plan to 2</button>
|
||||
<button @click.prevent="joinUserToAccount()">Join user to account</button>
|
||||
<button @click.prevent="changeUserAccessWithinAccount()">Change user access within account</button>
|
||||
<button @click.prevent="claimOwnershipOfAccount()">Claim Account Ownership</button>
|
||||
<button @click.prevent="store.joinUserToAccount(5)">Join user to account 5</button>
|
||||
<button @click.prevent="store.changeUserAccessWithinAccount(4, 5, 'ADMIN')">Change user 4 access within account 5 to ADMIN</button>
|
||||
<button @click.prevent="store.claimOwnershipOfAccount(5)">Claim Account 5 Ownership for current user</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user