Fixed error with sending of proofs

This commit is contained in:
2026-04-12 22:10:09 +01:00
parent 6ab77fe800
commit 5ca9954b0b
6 changed files with 29 additions and 56 deletions
@@ -25,34 +25,17 @@ export class ChallengeCardComponent {
color = input.required<string>();
data = input.required<GetRandomChallengeDto>();
selectedChallenge = signal<GetRandomChallengeDto>(null);
proof = viewChild<ProofFormComponent>('proofForm');
isModalOpen = false;
async setOpen(isOpen: boolean, randomChallengeId: number) {
if (isOpen) {
try {
const userInfo = await firstValueFrom(this.randomChallengesService.getRandomChallengeEndpoint(randomChallengeId));
this.selectedChallenge.set(userInfo);
this.isModalOpen = isOpen;
} catch {
const toast = await this.toastCtrl.create({
message: 'Impossible de charger les données du défi',
duration: 2000,
color: 'danger'
});
await toast.present();
}
}
async setOpen(isOpen: boolean) {
this.isModalOpen = isOpen;
}
async sendProof(randomChallengeId: number) {
const file = this.proof().proofForm.value.proof;
try {
await firstValueFrom(this.randomChallengesService.patchProofEndpoint(randomChallengeId, file));
await firstValueFrom(this.randomChallengesService.patchProofEndpoint(randomChallengeId, this.proof().proofForm.value.proof));
this.isModalOpen = false;
const toast = await this.toastCtrl.create({
@@ -68,7 +51,6 @@ export class ChallengeCardComponent {
color: 'danger'
});
await toast.present();
console.log(err)
}
}
}