Fixed error with sending of proofs
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
fill="clear"
|
||||
class="m-0 p-0 min-h-0 text-[11px] font-black bg-black text-white rounded-3xl"
|
||||
style="--padding-top: 4px; --padding-bottom: 4px;"
|
||||
(touchstart)="setOpen(true, data().id)">
|
||||
(touchstart)="setOpen(true)">
|
||||
{{ action() }}
|
||||
</ion-button>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
<ion-toolbar>
|
||||
<ion-title>Défi Quotidien</ion-title>
|
||||
<ion-buttons slot="start" style="--ion-color-primary: #0054E9;">
|
||||
<ion-back-button default-href="" (touchstart)="setOpen(false, null)"></ion-back-button>
|
||||
<ion-back-button default-href="" (touchstart)="setOpen(false)"></ion-back-button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ model/login-dto.ts
|
||||
model/models.ts
|
||||
model/patch-user-designation-dto.ts
|
||||
model/patch-user-password-dto.ts
|
||||
model/random-challenge-proof-request.ts
|
||||
model/refresh-token-dto.ts
|
||||
model/update-user-dto.ts
|
||||
model/user-proof-request.ts
|
||||
|
||||
@@ -18,8 +18,6 @@ import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
||||
|
||||
// @ts-ignore
|
||||
import { GetRandomChallengeDto } from '../model/get-random-challenge-dto';
|
||||
// @ts-ignore
|
||||
import { RandomChallengeProofRequest } from '../model/random-challenge-proof-request';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -152,21 +150,18 @@ export class RandomchallengesService extends BaseService {
|
||||
/**
|
||||
* @endpoint patch /API/RandomChallenges/{randomChallengeId}/Proof
|
||||
* @param randomChallengeId
|
||||
* @param randomChallengeProofRequest
|
||||
* @param proof
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public patchProofEndpoint(randomChallengeId: number, randomChallengeProofRequest: RandomChallengeProofRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public patchProofEndpoint(randomChallengeId: number, randomChallengeProofRequest: RandomChallengeProofRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public patchProofEndpoint(randomChallengeId: number, randomChallengeProofRequest: RandomChallengeProofRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public patchProofEndpoint(randomChallengeId: number, randomChallengeProofRequest: RandomChallengeProofRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public patchProofEndpoint(randomChallengeId: number, proof?: Blob, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public patchProofEndpoint(randomChallengeId: number, proof?: Blob, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public patchProofEndpoint(randomChallengeId: number, proof?: Blob, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public patchProofEndpoint(randomChallengeId: number, proof?: Blob, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (randomChallengeId === null || randomChallengeId === undefined) {
|
||||
throw new Error('Required parameter randomChallengeId was null or undefined when calling patchProofEndpoint.');
|
||||
}
|
||||
if (randomChallengeProofRequest === null || randomChallengeProofRequest === undefined) {
|
||||
throw new Error('Required parameter randomChallengeProofRequest was null or undefined when calling patchProofEndpoint.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -183,14 +178,27 @@ export class RandomchallengesService extends BaseService {
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
'multipart/form-data'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let localVarFormParams: { append(param: string, value: any): any; };
|
||||
let localVarUseForm = false;
|
||||
let localVarConvertFormParamsToString = false;
|
||||
// use FormData to transmit files using content-type "multipart/form-data"
|
||||
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
|
||||
localVarUseForm = canConsumeForm;
|
||||
if (localVarUseForm) {
|
||||
localVarFormParams = new FormData();
|
||||
} else {
|
||||
localVarFormParams = new HttpParams({encoder: this.encoder});
|
||||
}
|
||||
|
||||
if (proof !== undefined) {
|
||||
localVarFormParams = localVarFormParams.append('proof', <any>proof) as any || localVarFormParams;
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
@@ -209,7 +217,7 @@ export class RandomchallengesService extends BaseService {
|
||||
return this.httpClient.request<any>('patch', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: randomChallengeProofRequest,
|
||||
body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
|
||||
@@ -23,7 +23,6 @@ export * from './get-user-stats-dto';
|
||||
export * from './login-dto';
|
||||
export * from './patch-user-designation-dto';
|
||||
export * from './patch-user-password-dto';
|
||||
export * from './random-challenge-proof-request';
|
||||
export * from './refresh-token-dto';
|
||||
export * from './update-user-dto';
|
||||
export * from './user-proof-request';
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* BeReadyBackend
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface RandomChallengeProofRequest {
|
||||
proof?: Blob | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user