<script setup lang="ts">
import { inject } from "vue";
import { TokenInjectType } from "@/api";
import { useRoute, useRouter } from "vue-router";

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

const jwt = inject<TokenInjectType>("jwt") as TokenInjectType;

if ("token" in route.query) jwt.setToken(route.query["token"] as string);
router.replace({ path: "/" });
</script>

<template>
  <router-link to="/">Click here to go home</router-link>
</template>

<style scoped></style>
