Fixed error with sending of proofs
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user