<template>
  <div class="other-login">
    <p class="tips">Bem-vindo à 18N.com</p>
    <p class="tips" style="color:#fff;font-size: 12px;">Dicas quentes: 18N recomenda que os membros se registrem com o número de telefone correto. Se você esquecer seus detalhes de login, você ainda pode recuperar sua conta de jogo.</p>
    <div class="box flex-ct">
      <h-img
        width="4.5rem"
        height="1rem"
        src="base/google.png"
        @click="onGoogleLogin"
      />
    </div>
    <div class="line">OU</div>
  </div>
</template>

<script setup lang="ts">
// import axios from "axios";
// import { GOOGLE_USER_INFO } from "@/common/config";
// import { googleTokenLogin } from "vue3-google-login";
// import { closeLoading, showLoading, toast } from "@/utils/toast";
// import { getLocationParams } from "@/utils";
// import https from "@/https";
// import storage, { actions } from "@/utils/storage";
// import { useUserStore } from "@/stores/modules/user";
import useLogin from "@/hooks/useLogin";

const { googleLogin } = useLogin();
// const userStore = useUserStore();

function onGoogleLogin() {
  googleLogin();
  // googleTokenLogin().then(async (response: any) => {
  // axios
  //   .get(GOOGLE_USER_INFO, {
  //     params: { access_token: response.access_token },
  //   })
  //   .then(async (res: any) => {
  //     showLoading();
  //     let params: any = {
  //       google: res.data.sub,
  //     };
  //     let uid = getLocationParams(window.location.href);
  //     if (uid.u) {
  //       params.inviteUid = uid.u;
  //     }
  //     const { code, data, txt }: ResultData = await https.googleLogin(params);
  //     if (code !== 0) {
  //       toast(txt);
  //       closeLoading();
  //       return;
  //     }
  //     storage.setStorage(actions.USER_INFO, JSON.stringify(data));
  //     storage.setStorage(actions.USER_TOEKN, data.token);
  //     userStore.setUserInfo(data);
  //     connectSocket(data);
  //   })
  //   .catch((error) => {
  //     console.log(error);
  //   });
  // });
}
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>
