From 9384ece6574f2f1972a1678f019cea667062e187 Mon Sep 17 00:00:00 2001 From: Rakantor Date: Thu, 3 Nov 2022 18:13:05 +0100 Subject: [PATCH] Add user profile page --- components/NavigationDrawer.vue | 16 +---- pages/courses/_course/play.vue | 8 +-- pages/index.vue | 4 +- pages/user.vue | 119 ++++++++++++++++++++++++++++++++ plugins/user.js | 6 +- store/index.js | 3 + 6 files changed, 133 insertions(+), 23 deletions(-) create mode 100644 pages/user.vue diff --git a/components/NavigationDrawer.vue b/components/NavigationDrawer.vue index fef1a91..cd2647e 100644 --- a/components/NavigationDrawer.vue +++ b/components/NavigationDrawer.vue @@ -1,12 +1,12 @@ diff --git a/plugins/user.js b/plugins/user.js index 1ae2fe0..d56f8b9 100644 --- a/plugins/user.js +++ b/plugins/user.js @@ -1,5 +1,6 @@ export class User { - constructor (gamesStarted) { + constructor (displayName, gamesStarted) { + this.displayName = displayName this.gamesStarted = [] if (gamesStarted && gamesStarted.length > 0) { @@ -19,11 +20,12 @@ export const UserConverter = { }) return { + anzeigename: user.displayName, spieleBegonnen } }, fromFirestore: (snapshot, options) => { const data = snapshot.data(options) - return new User(data.spieleBegonnen) + return new User(data.anzeigename, data.spieleBegonnen) } } \ No newline at end of file diff --git a/store/index.js b/store/index.js index eaf3522..ec3df28 100644 --- a/store/index.js +++ b/store/index.js @@ -25,6 +25,9 @@ export const mutations = { setUser (state, user) { state.user = user }, + setUserDisplayName (state, name) { + this._vm.$set(state.user, 'displayName', name) + }, setCourses (state, courses) { state.courses = courses },