Skip to content

Commit 31971c0

Browse files
committed
ref
1 parent db05b61 commit 31971c0

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

pages/blob.vue

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,26 @@ const init = async (fromCache = false) => {
106106
return
107107
}
108108
109-
const rawMetadata = await fetchBlobMetadata({
110-
hash: hash.replaceAll(" ", "+"),
111-
height: parseInt(height),
112-
commitment: commitment.replaceAll(" ", "+"),
113-
metadata: true,
114-
})
115-
116-
const rawBlob = await fetchBlobByMetadata({
117-
hash: hash.replaceAll(" ", "+"),
118-
height: parseInt(height),
119-
commitment: commitment.replaceAll(" ", "+"),
120-
})
121-
122-
if (!rawBlob || !rawMetadata) {
109+
const [rawMetadata, rawBlob] = await Promise.all([
110+
fetchBlobMetadata({
111+
hash: hash.replaceAll(" ", "+"),
112+
height: parseInt(height),
113+
commitment: commitment.replaceAll(" ", "+"),
114+
metadata: true,
115+
}),
116+
fetchBlobByMetadata({
117+
hash: hash.replaceAll(" ", "+"),
118+
height: parseInt(height),
119+
commitment: commitment.replaceAll(" ", "+"),
120+
}),
121+
])
122+
123+
if (!rawBlob.data.value || !rawMetadata.data.value) {
123124
router.push("/")
124125
return
125126
} else {
126-
metadata.value = rawMetadata.data.value
127-
blob.value = rawBlob.data.value
127+
metadata.value = rawMetadata.data?.value
128+
blob.value = rawBlob.data?.value
128129
hex.value = Buffer.from(blob.value.data, "base64")
129130
.toString("hex")
130131
.match(/../g)
@@ -144,9 +145,9 @@ const init = async (fromCache = false) => {
144145
l2BlockscoutUrl.value = data?.value?.l2BlockscoutUrl
145146
}
146147
147-
onMounted(async () => {
148-
init()
148+
init()
149149
150+
onMounted(async () => {
150151
if (!supportedContentTypeForPreview.includes(blob.value?.content_type)) cards.value.preview = false
151152
152153
innerWidth.value = window.innerWidth

0 commit comments

Comments
 (0)