Polarcraft/web/components/Whitelist.vue

44 lines
1.2 KiB
Vue
Raw Normal View History

2023-05-03 11:36:20 +02:00
<template>
2023-05-06 13:14:01 +02:00
<div class="flex w-full flex-col items-center text-primary">
2023-05-03 11:36:20 +02:00
<div v-if="!user.minecraft.uuid" class="flex flex-col items-center">
2023-05-06 13:14:01 +02:00
<p class="mb-10 max-w-xl text-sm sm:text-base">
2023-05-03 11:36:20 +02:00
Je bent momenteel niet gewhitelist. Om toegang te krijgen tot de Minecraft server moet je in Minecraft naar de
server met het ip <span class="highlight">play.polarcraft.xeovalyte.com</span> gaan. Vervolgens krijg je een code
te zien, vul deze code hieronder in.
</p>
<div class="flex gap-2">
2023-05-27 12:02:33 +02:00
<Input v-model="code">Code</Input>
2023-05-03 11:36:20 +02:00
<Button @click="submitCode">Submit</Button>
</div>
</div>
</div>
</template>
<script setup>
definePageMeta({
middleware: ["auth"]
})
const user = useState('user')
const code = ref('')
const submitCode = async () => {
try {
const response = await $fetch('/api/minecraft/whitelist', {
method: 'POST',
body: {
code: code.value
}
})
user.value.minecraft.uuid = response.uuid
user.value.minecraft.username = response.username
2023-05-09 16:01:19 +02:00
useToast().success('Succesvol gewhitelist')
2023-05-03 11:36:20 +02:00
} catch (e) {
console.log(e);
useToast().error(e.statusMessage)
}
}
</script>