@@ -23,8 +23,9 @@ export default new Vuex.Store({
2323 walletAddress : '' ,
2424 avatar : '' ,
2525 avatarFile : '' ,
26- uploadPct : '' ,
26+ uploadPct : 0 ,
2727 avatarId : '' ,
28+ avatarLink : '' ,
2829 avatarAfterUpload : ''
2930 } ,
3031 mutations : {
@@ -46,6 +47,9 @@ export default new Vuex.Store({
4647 setAvatarId ( state , id ) {
4748 state . avatarId = id
4849 } ,
50+ setAvatarLink ( state , link ) {
51+ state . avatarLink = link
52+ } ,
4953 setAvatarAfterUpload ( state , avatar ) {
5054 state . avatarAfterUpload = avatar
5155 }
@@ -82,12 +86,13 @@ export default new Vuex.Store({
8286 while ( ! uploader . isComplete ) {
8387 await uploader . uploadChunk ( )
8488 commit ( 'setUploadPct' , uploader . pctComplete )
89+ console . log ( `${ uploader . pctComplete } % complete, ${ uploader . uploadedChunks } /${ uploader . totalChunks } ` )
8590 }
8691
8792 commit ( 'setAvatarId' , transaction . id )
93+ commit ( 'setAvatarLink' , 'https://arweave.net/' + transaction . id )
8894
89- const response = await ar . transactions . post ( transaction )
90- console . log ( response )
95+ await ar . transactions . post ( transaction )
9196 } )
9297 } ,
9398 setAvatarId ( { commit } , id ) {
@@ -97,6 +102,12 @@ export default new Vuex.Store({
97102 ar . transactions . getData ( id , { decode : true , string : true } ) . then ( data => {
98103 commit ( 'setAvatarAfterUpload' , data )
99104 } )
105+ } ,
106+ uploadReset ( { commit } ) {
107+ commit ( 'setAvatarAfterUpload' , '' )
108+ commit ( 'setAvatarLink' , '' )
109+ commit ( 'setAvatarId' , '' )
110+ commit ( 'setUploadPct' , 0 )
100111 }
101112 }
102113} )
0 commit comments