diff --git a/src/api/index.ts b/src/api/index.ts index c380d89..afdd11f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -61,3 +61,5 @@ export function fetchProfile(jwt: any) { Vue.$log.debug('JWT: ' + jwt); return axios.get(`${API_URL}/v1/user/profile`, { headers: { Authorization: `Bearer ${jwt}` } }); } + + diff --git a/src/api/userRepository.ts b/src/api/userRepository.ts index 98d2bca..bb22ac5 100644 --- a/src/api/userRepository.ts +++ b/src/api/userRepository.ts @@ -2,6 +2,9 @@ // @ts-ignore import Repository from './Repository'; +import Vue from 'vue/types/vue'; +import axios from 'axios'; +import {dictEmptyValToNull} from '@/utils'; const resource = '/user'; @@ -17,4 +20,8 @@ export default { createUser(userData: any) { return Repository.post(`${resource}`, userData); }, + + updateProfile(userData: any) { + return Repository.put(`${resource}/profile`, dictEmptyValToNull(userData)); + }, }; diff --git a/src/components/Profile.vue b/src/components/Profile.vue index 9e20f0e..26581f0 100644 --- a/src/components/Profile.vue +++ b/src/components/Profile.vue @@ -4,22 +4,62 @@
-

Profile

-

Token validity ({{tokenValidity}})

-

Refresh token validity ({{refreshTokenValidity}})

-

access_token ({{access_token}})

+
+ +

{{profile.nickname}}

+

+ {{profile.first_name}} {{profile.last_name}}

+

{{profile.email}}

+ +

+  {{profile.email}} + + +

+ +

{{$t('nickname')}}: {{profile.nickname}}

+ + + + + + + + + +
+ + +
+ +

{{$t('first_name')}}: {{profile.first_name}}

+

{{$t('last_name')}}: {{profile.last_name}}

+ + +
+

Token validity ({{tokenValidity}})

+

Refresh token validity ({{refreshTokenValidity}})

+

access_token ({{access_token}})

{{profile.id}}

{{ errorMsg }}

- diff --git a/src/main.ts b/src/main.ts index 2b65ccf..d356f88 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,6 +29,9 @@ import { faTrash, faPencilAlt, faCogs, + faAt, + faUser, + faEnvelope, } from '@fortawesome/free-solid-svg-icons'; import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'; @@ -41,7 +44,8 @@ import 'bootstrap-vue/dist/bootstrap-vue.css'; const isProduction = process.env.NODE_ENV === 'production'; -library.add(faCoffee, faTrash, faPencilAlt, faScroll, faCheck, faCircle, faList, faPlus, faDoorOpen, faCogs); +library.add(faCoffee, faTrash, faPencilAlt, faScroll, faCheck, faCircle, faList, faPlus, faDoorOpen, faCogs, faAt, + faUser, faEnvelope); Vue.component('font-awesome-icon', FontAwesomeIcon); diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 52a12e1..bcd2863 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -13,7 +13,7 @@ const messages = { links: 'Essential Links', ecosystem: 'Ecosystem', building_number: 'Building #', - building_name: 'Building' + building_name: 'Building', }, es: { welcomeMsg: 'Bienvenido a tu aplicación Vue.js + TypeScript',