Claiming a quest
Last updated
{
"message": "Your claim was successful!" // or a specific validation reason
}// Example: Claiming a quest with captcha
const response = await $fetch('https://your-community-slug.domino.page/api/quests/123/claim', {
method: 'POST',
body: {
questId: '123',
deploymentId: 'abc456',
taskInputs: [
{ answer: '42' },
{ answer: 'Domino' }
],
captchaToken: '10000000-xxxx-xxxx-xxxx-000000000001'
}
});
console.log(response.message);// Used in a Vue component to handle quest claims
async function claimQuest() {
try {
const res = await $fetch(`https://your-community-slug.domino.page/api/quests/${deployment.quest.id}/claim`, {
method: 'POST',
body: {
questId: deployment.quest.id,
deploymentId: deployment.id,
taskInputs: taskInputs,
captchaToken: captchaToken // only if required
}
});
// Show success message to user
emit('success', res.message);
} catch (error) {
// Handle error, show message to user
emit('error', error?.data?.data?.error || 'Claim failed');
}
}