All files / src/pages/profile me.vue

0% Statements 0/122
100% Branches 1/1
100% Functions 1/1
0% Lines 0/122

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168                                                                                                                                                                                                                                                                                                                                               
<template>
  <h2>ログイン情報</h2>
  <p>このページというかprofile以下で扱うものは以下とする</p>
  <ul>
    <li>ログイン情報</li>
    <li>スタッフ情報(履歴書に記載する氏名とか学歴・職歴以外の部分)</li>
    <li>住所(複数個有るかもしれない)</li>
    <li>最寄り駅</li>
  </ul>
  <p>職歴・学歴・保有スキルなどについては、ドロワナビに専用のコンテンツを作る</p>
  <v-btn
    text="再読み込み"
    @click="onReloadProfile" />
  <v-table>
    <tr>
      <th>id</th>
      <td>{{ profile.id }}</td>
    </tr>
    <tr>
      <th>uid</th>
      <td>{{ profile.uid }}</td>
    </tr>
    <tr>
      <th>displayName</th>
      <td>{{ profile.displayName }}</td>
    </tr>
    <tr>
      <th>email</th>
      <td>{{ profile.email }}</td>
    </tr>
    <tr>
      <th>emailVerified</th>
      <td>{{ profile.emailVerified }}</td>
    </tr>
    <tr>
      <th>photoUrl</th>
      <td>{{ profile.photoUrl }}</td>
    </tr>
    <tr>
      <th>disabled</th>
      <td>{{ profile.disabled }}</td>
    </tr>
    <tr>
      <th>lastLoginAt</th>
      <td>{{ profile.lastLoginAt }}</td>
    </tr>
    <tr>
      <th>createdAt</th>
      <td>{{ profile.createdAt }}</td>
    </tr>
    <tr>
      <th>updatedAt</th>
      <td>{{ profile.updatedAt }}</td>
    </tr>
    <tr>
      <th>deletedAt</th>
      <td>{{ profile.deletedAt }}</td>
    </tr>
  </v-table>
  <v-table>
    <thead>
      <tr>
        <th>id</th>
        <th>userId</th>
        <th>provider</th>
        <th>providerDisplayName</th>
        <th>emailAtSignup</th>
        <th>createdAt</th>
      </tr>
    </thead>
    <tbody>
      <tr
        v-for="item in identities"
        :key="item.id"
      >
        <td>{{ item.id }}</td>
        <td>{{ item.userId }}</td>
        <td>{{ item.provider }}</td>
        <td>{{ item.providerDisplayName }}</td>
        <td>{{ item.emailAtSignup }}</td>
        <td>{{ item.createdAt }}</td>
      </tr>
    </tbody>
  </v-table>
</template>
 
<script setup lang="ts">
// region Dependency Injection
import {useApi} from '@/composables/useApi'
import {useSchemaLogger} from '@/libs/logger/logger'
import {onMounted, ref} from "vue";
import {withLoading} from "@/libs/loading";
import {normalizeError} from "@/utils";
// endregion Dependency Injection
 
// region Component Injection
// endregion Component Injection
 
// region interface
// endregion interface
 
// region constants
const api = useApi()
const logger = useSchemaLogger({module: 'me'})
// endregion constants
 
// region props
// endregion props
 
// region variable
// endregion variable
 
// region properties
const profile = ref({})
const identities = ref([])
// endregion properties
 
// region emits
// endregion emits
 
// region validator
// endregion validator
 
// region methods
const onReloadProfile = async () => {
  try {
    // logger.debug('再読み込み開始:ローティング開始')
    const res = await withLoading(() => handleFetchProfile(), 'me:reloadProfile')
    profile.value = res.user
    identities.value = res.authIdentities
  } catch (e) {
    logger.error('error', normalizeError(e))
  }
}
const handleFetchProfile = async () => {
  try {
    const apiResponse = await api.get('/fl/profile/me')
    // console.log(`response data : ${JSON.stringify(apiResponse)}`)
    return apiResponse.data
  } catch (e) {
    logger.error('error', e)
    logger.error('error', normalizeError(e))
  }
}
 
onMounted(async () => {
  try {
    const [user] = await withLoading(async () => {
      return await Promise.all([
        handleFetchProfile()
      ])
    }, 'me:onMounted')
    profile.value = user.user
    identities.value = user.authIdentities
  } catch (e) {
    logger.error('e: ', e)
  }
})
// endregion methods
 
// region export
// endregion export
</script>
 
<style scoped>
 
</style>