first pass of RBAC systems
This commit is contained in:
@@ -10,10 +10,6 @@
|
||||
<Button variant="default" @click="goHome">
|
||||
Go to Home
|
||||
</Button>
|
||||
|
||||
<Button variant="outline" @click="loginIfNeeded">
|
||||
Log In
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -21,7 +17,7 @@
|
||||
<script setup lang="ts">
|
||||
import Button from '@/components/ui/button/Button.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user' // adjust path to your store
|
||||
import { useUserStore } from '@/stores/user'
|
||||
|
||||
const router = useRouter()
|
||||
const user = useUserStore()
|
||||
@@ -29,12 +25,4 @@ const user = useUserStore()
|
||||
function goHome() {
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
function loginIfNeeded() {
|
||||
if (!user.isLoggedIn) {
|
||||
window.location.href = 'https://your-auth-service/login'
|
||||
} else {
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user