Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
P
ptarpwatraining
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
training
ptarpwatraining
Commits
688023ef
Commit
688023ef
authored
May 05, 2021
by
Azrul Amir
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.uitm.edu.my/training/ptarpwatraining
parents
95c09b4e
8b9b3ba8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
MainLayout.vue
src/layouts/MainLayout.vue
+7
-1
index.js
src/store/index.js
+2
-2
store-user.js
src/store/store-user.js
+39
-0
No files found.
src/layouts/MainLayout.vue
View file @
688023ef
...
...
@@ -40,7 +40,7 @@
</q-btn>
<q-btn
round
flat
>
<q-avatar
size=
"26px"
@
click=
"loginGoogle"
>
<img
:src=
"
defaultA
vatar"
>
<img
:src=
"
user.a
vatar"
>
</q-avatar>
<q-tooltip>
Account
</q-tooltip>
</q-btn>
...
...
@@ -137,6 +137,7 @@
</
template
>
<
script
>
import
{
mapGetters
,
mapActions
}
from
"vuex"
import
{
fabYoutube
}
from
'@quasar/extras/fontawesome-v5'
export
default
{
name
:
'MyLayout'
,
...
...
@@ -191,7 +192,11 @@ export default {
created
()
{
this
.
fabYoutube
=
fabYoutube
},
computed
:
{
...
mapGetters
(
"user"
,
[
"user"
]),
},
methods
:
{
...
mapActions
(
'user'
,[
'updateUser'
]),
async
loginGoogle
()
{
try
{
const
googleUser
=
await
this
.
$gAuth
.
signIn
()
...
...
@@ -213,6 +218,7 @@ export default {
this
.
userUpdate
.
isAuth
=
true
this
.
defaultAvatar
=
this
.
userUpdate
.
avatar
console
.
log
(
bio
)
this
.
updateUser
(
this
.
userUpdate
)
// this.upsertUser()
if
(
this
.
$route
.
query
.
redirect
){
...
...
src/store/index.js
View file @
688023ef
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
user
from
'./store-user'
// import example from './module-example'
Vue
.
use
(
Vuex
)
...
...
@@ -17,7 +17,7 @@ Vue.use(Vuex)
export
default
function
(
/* { ssrContext } */
)
{
const
Store
=
new
Vuex
.
Store
({
modules
:
{
// example
user
},
// enable strict mode (adds overhead!)
...
...
src/store/store-user.js
0 → 100644
View file @
688023ef
const
state
=
{
user
:
{
token
:
''
,
firstName
:
''
,
lastName
:
''
,
email
:
''
,
avatar
:
'https://cdn.quasar.dev/img/boy-avatar.png'
,
fullname
:
''
,
id
:
''
,
isAdmin
:
false
,
isAuth
:
false
}
}
const
mutations
=
{
updateUser
(
state
,
user
)
{
Object
.
assign
(
state
.
user
,
user
)
}
}
const
actions
=
{
updateUser
({
commit
},
payload
)
{
commit
(
'updateUser'
,
payload
)
}
}
const
getters
=
{
user
:
(
state
)
=>
{
return
state
.
user
}
}
export
default
{
namespaced
:
true
,
state
,
mutations
,
actions
,
getters
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment