@@ -109,15 +109,7 @@ export default Vue.extend({
109109 if (! window .location .search .includes (' id=' )) {
110110 const _diff = this .$route .hash
111111 if (_diff ) {
112- const gunzip = pako .ungzip (
113- Buffer .from (undoUrlSafeBase64 (_diff ), ' base64' )
114- )
115- const diffData = JSON .parse (Buffer .from (gunzip ).toString (' utf8' ))
116- const { lhs, rhs, lhsLabel, rhsLabel } = diffData
117- this .lhsLabel = lhsLabel
118- this .rhsLabel = rhsLabel
119- this .lhs = lhs
120- this .rhs = rhs
112+ this .unzipCommitData (_diff )
121113 }
122114 }
123115 },
@@ -127,21 +119,7 @@ export default Vue.extend({
127119 if (! data ) {
128120 return
129121 }
130- const gunzip = pako .ungzip (
131- Buffer .from (undoUrlSafeBase64 (data ), ' base64' )
132- )
133- const diffData = JSON .parse (Buffer .from (gunzip ).toString (' utf8' ))
134- const { lhs, rhs, lhsLabel, rhsLabel } = diffData
135- this .lhsLabel = lhsLabel
136- this .rhsLabel = rhsLabel
137- this .lhs = lhs
138- this .rhs = rhs
139- this .$store .commit (' data/set' , {
140- lhs: this .lhs ,
141- rhs: this .rhs ,
142- lhsLabel: this .lhsLabel ,
143- rhsLabel: this .rhsLabel ,
144- })
122+ this .unzipCommitData (data )
145123 this .e2eDataStatusText = ' '
146124 this .renderDiff ()
147125 })
@@ -212,15 +190,24 @@ export default Vue.extend({
212190 }
213191 )
214192 }
215- this .$store .commit (' data/set' , {
216- lhs: this .lhs ,
217- rhs: this .rhs ,
218- lhsLabel: this .lhsLabel ,
219- rhsLabel: this .rhsLabel ,
220- })
221193 }
222194 })
223195 },
196+ unzipCommitData(data : string ) {
197+ const gunzip = pako .ungzip (Buffer .from (undoUrlSafeBase64 (data ), ' base64' ))
198+ const diffData = JSON .parse (Buffer .from (gunzip ).toString (' utf8' ))
199+ const { lhs, rhs, lhsLabel, rhsLabel } = diffData
200+ this .lhsLabel = lhsLabel
201+ this .rhsLabel = rhsLabel
202+ this .lhs = lhs
203+ this .rhs = rhs
204+ this .$store .commit (' data/set' , {
205+ lhs: this .lhs ,
206+ rhs: this .rhs ,
207+ lhsLabel: this .lhsLabel ,
208+ rhsLabel: this .rhsLabel ,
209+ })
210+ },
224211 },
225212})
226213 </script >
0 commit comments