Skip to content

Commit 671ff2d

Browse files
committed
Merge branch 'bugfix/share-modal-duplicate' into 'devel'
Sharing to the same container twice did not show error toast Closes #1016 See merge request sds-dev/sd-connect/swift-browser-ui!78
2 parents d55f506 + 3288b2b commit 671ff2d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

swift_browser_ui_frontend/src/common/swift_x_account_sharing_bind.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ class SwiftXAccountSharing {
160160
let shared = fetch(
161161
url, { method: "POST" },
162162
).then(
163-
(resp) => { return resp.json(); },
163+
(resp) => {
164+
if (resp.status == 409) {
165+
throw new Error("Container already shared.");
166+
}
167+
return resp.json();
168+
},
164169
);
165170
return shared;
166171
}

swift_browser_ui_frontend/src/components/ShareModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export default {
322322
);
323323
}
324324
catch(error) {
325-
if (error instanceof TypeError) {
325+
if (error.message.match("Container already shared.")) {
326326
document.querySelector("#shareModal-toasts").addToast(
327327
{
328328
id: "error-duplicate",

0 commit comments

Comments
 (0)