diff --git a/src/client.ts b/src/client.ts index 422e3c95..80d1b152 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1028,7 +1028,7 @@ export class VocdoniSDKClient { async cspUrl(): Promise { invariant(this.electionId, 'No election id set'); - return this.fetchElection(this.electionId).then(this.cspService.setUrlFromElection); + return this.fetchElection(this.electionId).then((election) => this.cspService.setUrlFromElection(election)); } async cspInfo() { @@ -1037,6 +1037,8 @@ export class VocdoniSDKClient { async cspStep(stepNumber: number, data: any[], authToken?: string) { invariant(this.electionId, 'No election id set'); + await this.cspUrl(); + await this.cspInfo(); return this.cspService.cspStep(this.electionId, stepNumber, data, authToken); }