@@ -73,7 +73,8 @@ import { getDecryptedText, getDepryctionKey } from '~/helpers/decrypt'
73
73
import { v2DiffData } from ' ~/helpers/types'
74
74
import {
75
75
E2E_DATA_DECRYPTING_INFO ,
76
- E2E_DATA_ERROR ,
76
+ E2E_DATA_DECRYPTION_ERROR ,
77
+ E2E_DATA_FETCH_ERROR ,
77
78
E2E_DATA_FINALIZING_INFO ,
78
79
E2E_DATA_LOADING_INFO ,
79
80
E2E_DATA_NO_LONGER_AVAILABLE_ERROR ,
@@ -134,12 +135,20 @@ export default Vue.extend({
134
135
},
135
136
async getE2EData() {
136
137
this .e2eDataStatusText = E2E_DATA_LOADING_INFO
138
+ const url = new URL (window .location .href )
139
+ const id = url .searchParams .get (' id' )
140
+ const key = url .hash .replace (/ ^ #/ , ' ' )
141
+ let response = null ;
142
+ let data = null
143
+ try {
144
+ response = await fetch (` /api/getLink?id=${id } ` )
145
+ data = await response .json ()
146
+ } catch (error ) {
147
+ console .error (error )
148
+ this .e2eDataStatusText = E2E_DATA_FETCH_ERROR
149
+ return null
150
+ }
137
151
try {
138
- const url = new URL (window .location .href )
139
- const id = url .searchParams .get (' id' )
140
- const key = url .hash .replace (/ ^ #/ , ' ' )
141
- const response = await fetch (` /api/getLink?id=${id } ` )
142
- const data = await response .json ()
143
152
if (data .length === 0 ) {
144
153
this .e2eDataStatusText = E2E_DATA_NO_LONGER_AVAILABLE_ERROR
145
154
return null
@@ -157,7 +166,7 @@ export default Vue.extend({
157
166
return decryptedData
158
167
} catch (error ) {
159
168
console .error (error )
160
- this .e2eDataStatusText = E2E_DATA_ERROR
169
+ this .e2eDataStatusText = E2E_DATA_DECRYPTION_ERROR
161
170
return null
162
171
}
163
172
},
0 commit comments