File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed
Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1313 />
1414 </div >
1515 <inputTextLabel
16+ v-model =" authorName"
1617 label =" Name"
1718 placeholder =" Enter your name"
1819 name =" profile_name"
1920 class =" profile__field"
2021 />
2122 <inputTextLabel
23+ v-model =" authorEmail"
2224 label =" Email"
2325 placeholder =" Enter your email address"
2426 name =" profile_email"
2527 class =" profile__field"
2628 />
2729 <inputTextLabel
30+ v-model =" authorImage"
2831 label =" Image"
2932 placeholder =" Paste your image"
3033 name =" profile_image"
@@ -46,6 +49,39 @@ export default {
4649 computed: {
4750 profileData () {
4851 return this .$store .getters [" settings/getProfile" ];
52+ },
53+ authorName: {
54+ get : function () {
55+ return this .profileData .author .name ;
56+ },
57+ set : function (value ) {
58+ this .$store .dispatch ({
59+ type: " settings/updateAuthorName" ,
60+ name: value
61+ });
62+ }
63+ },
64+ authorEmail: {
65+ get : function () {
66+ return this .profileData .author .email ;
67+ },
68+ set : function (value ) {
69+ this .$store .dispatch ({
70+ type: " settings/updateAuthorEmail" ,
71+ email: value
72+ });
73+ }
74+ },
75+ authorImage: {
76+ get : function () {
77+ return this .profileData .author .imageUrl ;
78+ },
79+ set : function (value ) {
80+ this .$store .dispatch ({
81+ type: " settings/updateAuthorImage" ,
82+ image: value
83+ });
84+ }
4985 }
5086 }
5187};
Original file line number Diff line number Diff line change @@ -23,12 +23,51 @@ const mutations = {
2323 state . experimental = JSON . parse ( localStorage . getItem ( "settings" ) ) . experimental ;
2424 }
2525 } ,
26+ setSettings ( state ) {
27+ localStorage . setItem ( "settings" , JSON . stringify ( state ) ) ;
28+ } ,
29+ authorName ( state , payload ) {
30+ state . profile . author . name = payload . name ;
31+ } ,
32+ authorEmail ( state , payload ) {
33+ state . profile . author . email = payload . email ;
34+ } ,
35+ authorImage ( state , payload ) {
36+ state . profile . author . imageUrl = payload . image ;
37+ } ,
2638 toggleFileChanges ( state , payload ) {
2739 state . experimental . fileChanges = payload . fileChanges ;
2840 }
2941} ;
3042
3143const actions = {
44+ updateAuthorName : ( { commit } , payload ) => {
45+ commit ( {
46+ type : "authorName" ,
47+ name : payload . name
48+ } ) ;
49+ commit ( {
50+ type : "setSettings"
51+ } ) ;
52+ } ,
53+ updateAuthorEmail : ( { commit } , payload ) => {
54+ commit ( {
55+ type : "authorEmail" ,
56+ email : payload . email
57+ } ) ;
58+ commit ( {
59+ type : "setSettings"
60+ } ) ;
61+ } ,
62+ updateAuthorImage : ( { commit } , payload ) => {
63+ commit ( {
64+ type : "authorImage" ,
65+ image : payload . image
66+ } ) ;
67+ commit ( {
68+ type : "setSettings"
69+ } ) ;
70+ } ,
3271 updateFileChanges : ( { commit } , payload ) => {
3372 commit ( {
3473 type : "toggleFileChanges" ,
You can’t perform that action at this time.
0 commit comments