<template>
  <div>
    <SelectAuthWay
      v-if="globalState.userInfos.auth_suc === 0 && mode === ''"
      :setMode="setMode"
    ></SelectAuthWay>
    <AuthPersonal
      v-if="mode === 'p'"
      @update="
        () => {
          $emit('ToUpdate');
          mode = '';
        }
      "
      @select="mode = ''"
    ></AuthPersonal>
    <AuthCompany
      v-if="mode === 'c'"
      @update="
        () => {
          $emit('ToUpdate');
          mode = '';
        }
      "
      @select="mode = ''"
    ></AuthCompany>
    <DisplayAuthData v-if="ident.status"></DisplayAuthData>
  </div>
</template>
<script lang="ts" setup>
import { globalState } from "@/store/state";
import { computed, inject, ref } from "vue";
import { useRoute } from "vue-router";
import DisplayAuthData from "./DisplayAuthData.vue";
import SelectAuthWay from "./SelectAuthWay.vue";
import AuthPersonal from "./AuthPersonal.vue";
import AuthCompany from "./AuthCompany.vue";

const route = useRoute();

const ident = inject<any>("ident");
const props = defineProps<{
  infos: any;
}>();
const mode = ref("");
const setMode = (v: string) => (mode.value = v);
const emit = defineEmits(["ToUpdate"]);
</script>
<style scoped lang="scss"></style>
