fix problem where canceling an edit deletes an image
This commit is contained in:
@@ -517,7 +517,10 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
// Only delete if the image was freshly uploaded, not loaded from an existing claim
|
||||||
|
if (this.imageUrl !== this.prevCredToEdit?.claim?.image) {
|
||||||
this.deleteImage(); // not awaiting, so they'll go back immediately
|
this.deleteImage(); // not awaiting, so they'll go back immediately
|
||||||
|
}
|
||||||
if (this.destinationPathAfter) {
|
if (this.destinationPathAfter) {
|
||||||
(this.$router as Router).push({ path: this.destinationPathAfter });
|
(this.$router as Router).push({ path: this.destinationPathAfter });
|
||||||
} else {
|
} else {
|
||||||
@@ -526,7 +529,10 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancelBack() {
|
cancelBack() {
|
||||||
|
// Only delete if the image was freshly uploaded, not loaded from an existing claim
|
||||||
|
if (this.imageUrl !== this.prevCredToEdit?.claim?.image) {
|
||||||
this.deleteImage(); // not awaiting, so they'll go back immediately
|
this.deleteImage(); // not awaiting, so they'll go back immediately
|
||||||
|
}
|
||||||
(this.$router as Router).back();
|
(this.$router as Router).back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user