Display election ID in the response and insert voters in a goroutine
This commit is contained in:
@ -61,6 +61,17 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div v-if="createdElectionId > 0" class="election-info">
|
||||
<h2>Election Created Successfully</h2>
|
||||
<div class="info-container">
|
||||
<span class="info-label">Election ID:</span>
|
||||
<span class="info-value">{{ createdElectionId }}</span>
|
||||
<button @click="copyElectionId" class="copy-btn">
|
||||
Copy
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="voterIdentities.length > 0" class="voter-codes">
|
||||
<h2>Voter Access Codes</h2>
|
||||
<div class="codes-container">
|
||||
@ -95,6 +106,7 @@
|
||||
expiresAt: "",
|
||||
choices: ["", ""] // Start with two empty choices
|
||||
},
|
||||
createdElectionId: 0,
|
||||
voterIdentities: []
|
||||
};
|
||||
},
|
||||
@ -138,7 +150,12 @@
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
const locationHeader = response.headers.get('Location');
|
||||
this.createdElectionId = locationHeader.replace('/election/', '');
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
this.voterIdentities = data.voterIdentities;
|
||||
})
|
||||
|
Reference in New Issue
Block a user