From 5a5dd68af6108eead754a0ef91166940509dcbc3 Mon Sep 17 00:00:00 2001
From: Eric <5089238+emizzle@users.noreply.github.com>
Date: Mon, 1 Jul 2024 17:00:43 +1000
Subject: [PATCH] cancel image downloading when unmounting
---
src/components/CodexImage.vue | 42 ++++++++++++++++++++++++++++-------
src/plugins/CodexPlugin.js | 4 ++--
2 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/components/CodexImage.vue b/src/components/CodexImage.vue
index 3ca50f2..c8e8a10 100644
--- a/src/components/CodexImage.vue
+++ b/src/components/CodexImage.vue
@@ -1,5 +1,5 @@
diff --git a/src/plugins/CodexPlugin.js b/src/plugins/CodexPlugin.js
index 2a409aa..315a3e3 100644
--- a/src/plugins/CodexPlugin.js
+++ b/src/plugins/CodexPlugin.js
@@ -2,8 +2,8 @@ export default {
install: (app, { codexRestUrl, myAddress }) => {
const codexApi = {
info: () => fetch(`${codexRestUrl}/debug/info`),
- download: (cid) => fetch(`${codexRestUrl}/data/${cid}/network`),
- downloadLocal: (cid) => fetch(`${codexRestUrl}/data/${cid}`),
+ download: (cid, options) => fetch(`${codexRestUrl}/data/${cid}/network`, options),
+ downloadLocal: (cid, options) => fetch(`${codexRestUrl}/data/${cid}`, options),
spr: () => fetch(`${codexRestUrl}/spr`)
}