mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Update vue-toast-notification and use in signature app
This commit is contained in:
parent
64e527672d
commit
e57d52d00e
@ -59,7 +59,7 @@
|
|||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
"vue-i18n": "^9.1.6",
|
"vue-i18n": "^9.1.6",
|
||||||
"vue-multiselect": "3.0.0-alpha.2",
|
"vue-multiselect": "3.0.0-alpha.2",
|
||||||
"vue-toast-notification": "^2.0",
|
"vue-toast-notification": "^3.1.2",
|
||||||
"vuex": "^4.0.0"
|
"vuex": "^4.0.0"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
@ -113,6 +113,8 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, Ref, reactive } from "vue";
|
import { ref, Ref, reactive } from "vue";
|
||||||
|
import { useToast } from "vue-toast-notification";
|
||||||
|
import "vue-toast-notification/dist/theme-sugar.css";
|
||||||
import { Signature, SignatureZone, SignedState } from "../../types";
|
import { Signature, SignatureZone, SignedState } from "../../types";
|
||||||
import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
|
import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
|
||||||
import * as pdfjsLib from "pdfjs-dist";
|
import * as pdfjsLib from "pdfjs-dist";
|
||||||
@ -152,6 +154,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const $toast = useToast();
|
||||||
|
|
||||||
const signature = window.signature;
|
const signature = window.signature;
|
||||||
const urlInfo = build_download_info_link(signature.storedObject.filename);
|
const urlInfo = build_download_info_link(signature.storedObject.filename);
|
||||||
|
|
||||||
@ -330,8 +334,10 @@ const checkSignature = () => {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
signedState.value = "error";
|
signedState.value = "error";
|
||||||
console.log('Error while checking the signature', error);
|
console.log("Error while checking the signature", error);
|
||||||
//TODO toast error
|
$toast.error(
|
||||||
|
`Erreur lors de la vérification de la signature: ${error.txt}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -348,17 +354,19 @@ const checkForReady = () => {
|
|||||||
signedState.value = "error";
|
signedState.value = "error";
|
||||||
stopTrySigning();
|
stopTrySigning();
|
||||||
console.log("Reached the maximum number of tentative to try signing");
|
console.log("Reached the maximum number of tentative to try signing");
|
||||||
//TODO toast error
|
$toast.error(
|
||||||
|
"Le nombre maximum de tentatives pour essayer de signer est atteint"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (signedState.value === "rejected") {
|
if (signedState.value === "rejected") {
|
||||||
stopTrySigning();
|
stopTrySigning();
|
||||||
console.log("Signature rejected by the server");
|
console.log("Signature rejected by the server");
|
||||||
//TODO toast error
|
$toast.error("Signature rejetée par le serveur");
|
||||||
}
|
}
|
||||||
if (signedState.value === "canceled") {
|
if (signedState.value === "canceled") {
|
||||||
stopTrySigning();
|
stopTrySigning();
|
||||||
console.log("Signature canceledconsole.log('Error while posting the signature', error);");
|
console.log("Signature canceled");
|
||||||
//TODO toast error
|
$toast.error("Signature annulée");
|
||||||
}
|
}
|
||||||
if (signedState.value === "pending") {
|
if (signedState.value === "pending") {
|
||||||
tryForReady = tryForReady + 1;
|
tryForReady = tryForReady + 1;
|
||||||
@ -383,9 +391,9 @@ const confirmSign = () => {
|
|||||||
checkForReady();
|
checkForReady();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log('Error while posting the signature', error);
|
console.log("Error while posting the signature", error);
|
||||||
stopTrySigning();
|
stopTrySigning();
|
||||||
//TODO toast
|
$toast.error(`Erreur lors de la soumission de la signature: ${error.txt}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user