Skip to content

Commit

Permalink
feat(whitelistlink): mutation on otp
Browse files Browse the repository at this point in the history
  • Loading branch information
veryCrunchy committed Apr 10, 2024
1 parent bd13e29 commit c143e9c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
24 changes: 17 additions & 7 deletions pages/minecraft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ import OtpInput from "@/components/otp/input.vue";
const otpInput = ref<InstanceType<typeof OtpInput> | null>(null);
const bindModal = ref("");
const handleOnComplete = (value: string) => {
async function handleOnComplete(value: string) {
console.log("OTP completed: ", value);
setTimeout(() => {
otpInput.value?.clearInput();
}, 100);
};
try {
const res = await GqlWhitelistLink({
code: Number(value),
});
if (res.whitelistLink.status === 200)
push.success(res.whitelistLink.message);
else push.error(res.whitelistLink.message);
} catch (e) {
push.error((e as any).gqlErrors[0].message);
}
}
const change = (value: string) => {
console.log("OTP change: ", value);
};
const fillInput = (value: string) => {
console.log(value);
otpInput.value?.fillInput(value);
};
const user = useUser();
</script>
Expand Down Expand Up @@ -153,7 +159,11 @@ const user = useUser();
id="modal-title"
class="text-lg font-medium text-white"
>
{{user ? "Enter your whitelist code" : "Please login to continue"}}
{{
user
? "Enter your whitelist code"
: "Please login to continue"
}}
</h2>
<h2
v-else
Expand Down
6 changes: 6 additions & 0 deletions queries/whitelist.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mutation whitelistLink($code: Int!) {
whitelistLink(code: $code) {
status
message
}
}

0 comments on commit c143e9c

Please sign in to comment.