<script setup lang="ts">
definePageMeta({
  layout: "invite",
});
import { useLogin } from "~/api/login/loginService";
const { inviteRegister } = useLogin();
const route = useRoute();
const user = useUserStore();
const code = route.query.code || ("" as string);

async function inviteRegisterFun() {
  let res: any = await inviteRegister(code as any);
  if (res.code == 200) {
    navigateTo("/register");
  }else{
    navigateTo("/");
  }
}
onMounted(() => {
  const isLogin = useCookie("tokenKey");
  if (code && !isLogin.value) {
    inviteRegisterFun();
  } else {
    navigateTo("/");
  }
});
</script>
<template>
  <div class="invite-bg">
  </div>
</template>
<style scoped lang="scss">
.codeImg {
}
</style>
