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
8b9b3ba8
Commit
8b9b3ba8
authored
May 05, 2021
by
adamrusly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new: add store
parent
05732c80
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 @
8b9b3ba8
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
</q-btn>
</q-btn>
<q-btn
round
flat
>
<q-btn
round
flat
>
<q-avatar
size=
"26px"
@
click=
"loginGoogle"
>
<q-avatar
size=
"26px"
@
click=
"loginGoogle"
>
<img
:src=
"
defaultA
vatar"
>
<img
:src=
"
user.a
vatar"
>
</q-avatar>
</q-avatar>
<q-tooltip>
Account
</q-tooltip>
<q-tooltip>
Account
</q-tooltip>
</q-btn>
</q-btn>
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapGetters
,
mapActions
}
from
"vuex"
import
{
fabYoutube
}
from
'@quasar/extras/fontawesome-v5'
import
{
fabYoutube
}
from
'@quasar/extras/fontawesome-v5'
export
default
{
export
default
{
name
:
'MyLayout'
,
name
:
'MyLayout'
,
...
@@ -191,7 +192,11 @@ export default {
...
@@ -191,7 +192,11 @@ export default {
created
()
{
created
()
{
this
.
fabYoutube
=
fabYoutube
this
.
fabYoutube
=
fabYoutube
},
},
computed
:
{
...
mapGetters
(
"user"
,
[
"user"
]),
},
methods
:
{
methods
:
{
...
mapActions
(
'user'
,[
'updateUser'
]),
async
loginGoogle
()
{
async
loginGoogle
()
{
try
{
try
{
const
googleUser
=
await
this
.
$gAuth
.
signIn
()
const
googleUser
=
await
this
.
$gAuth
.
signIn
()
...
@@ -213,6 +218,7 @@ export default {
...
@@ -213,6 +218,7 @@ export default {
this
.
userUpdate
.
isAuth
=
true
this
.
userUpdate
.
isAuth
=
true
this
.
defaultAvatar
=
this
.
userUpdate
.
avatar
this
.
defaultAvatar
=
this
.
userUpdate
.
avatar
console
.
log
(
bio
)
console
.
log
(
bio
)
this
.
updateUser
(
this
.
userUpdate
)
// this.upsertUser()
// this.upsertUser()
if
(
this
.
$route
.
query
.
redirect
){
if
(
this
.
$route
.
query
.
redirect
){
...
...
src/store/index.js
View file @
8b9b3ba8
import
Vue
from
'vue'
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
Vuex
from
'vuex'
import
user
from
'./store-user'
// import example from './module-example'
// import example from './module-example'
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
...
@@ -17,7 +17,7 @@ Vue.use(Vuex)
...
@@ -17,7 +17,7 @@ Vue.use(Vuex)
export
default
function
(
/* { ssrContext } */
)
{
export
default
function
(
/* { ssrContext } */
)
{
const
Store
=
new
Vuex
.
Store
({
const
Store
=
new
Vuex
.
Store
({
modules
:
{
modules
:
{
// example
user
},
},
// enable strict mode (adds overhead!)
// enable strict mode (adds overhead!)
...
...
src/store/store-user.js
0 → 100644
View file @
8b9b3ba8
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