<script setup>
  import { onMounted } from "vue";

  onMounted(() => {
    const q = new URLSearchParams(window.location.search);
    const accessToken = q.get("accessToken");
    const refreshToken = q.get("refreshToken");
    const user = q.get("user") ? JSON.parse(decodeURIComponent(q.get("user"))) : null;

    if (accessToken && window.opener) {
      window.opener.postMessage(
        {
          accessToken,
          refreshToken,
          user,
        },
        "http://0.0.0.0:3000"
      );

      window.close();
    }
  });
</script>

<template>
  <div>로그인 완료, 창을 닫습니다...</div>
</template>
