<script setup lang="ts">
		import { useRoute, useRouter } from 'vue-router'
		import { ref } from "vue";
		import AdminPanelLib from "../../adminpanellib.ts";
		import Navbar from "../Navbar.vue";

		const route = useRoute();
		const router = useRouter();

		const token=ref(route.params.token);
		const userinfo=ref({})

		AdminPanelLib.AdminPanelLib.getUserInfo(token.value)
		.then((result)=>{
				if(result) return result;
				else router.push({"path":"/adminpanel/login"});
		})
		.then((result)=>userinfo.value=result);

		const links=[
				{ "title":"Startseite", "link":"/adminpanel/"+token.value }, 
				{ "title":"Formulare", "link":"/adminpanel/"+token.value+"/formulare" }, 
				{ "title":"Events", "link":"/adminpanel/"+token.value+"/events" }
		]

		function logout(){
				router.push({"path":"/adminpanel/login"});
		}

</script>
<template>
		<Navbar :links="links" buttontext="Abmelden" @clickbtn="logout"/>
</template>
<style scoped lang="scss">
		
</style>
