🐛 Fix spells page
This commit is contained in:
@@ -9,42 +9,62 @@
|
|||||||
<div v-else-if="!!spell">
|
<div v-else-if="!!spell">
|
||||||
<p class="mb-2">Magic spell for {{ spellTypes[spell.type] ?? 'unknown' }}</p>
|
<p class="mb-2">Magic spell for {{ spellTypes[spell.type] ?? 'unknown' }}</p>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<n-icon size="18"><account-circle-outlined /></n-icon>
|
<n-icon size="18">
|
||||||
|
<account-circle-outlined/>
|
||||||
|
</n-icon>
|
||||||
<b>@{{ spell.account.name }}</b>
|
<b>@{{ spell.account.name }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<n-icon size="18"><play-arrow-filled /></n-icon>
|
<n-icon size="18">
|
||||||
|
<play-arrow-filled/>
|
||||||
|
</n-icon>
|
||||||
<span>Available at</span>
|
<span>Available at</span>
|
||||||
<b>{{ new Date(spell.created_at ?? spell.affected_at).toLocaleString() }}</b>
|
<b>{{ new Date(spell.created_at ?? spell.affected_at).toLocaleString() }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1" v-if="spell.expired_at">
|
<div class="flex items-center gap-1" v-if="spell.expired_at">
|
||||||
<n-icon size="18"><date-range-filled /></n-icon>
|
<n-icon size="18">
|
||||||
|
<date-range-filled/>
|
||||||
|
</n-icon>
|
||||||
<span>Until</span>
|
<span>Until</span>
|
||||||
<b>{{ spell.expired_at.toString() }}</b>
|
<b>{{ spell.expired_at.toString() }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<n-input v-if="spell.type == 3" v-model:value="newPassword" />
|
<n-input
|
||||||
|
v-if="spell.type == 3"
|
||||||
|
v-model:value="newPassword"
|
||||||
|
placeholder="New password"
|
||||||
|
type="password"
|
||||||
|
show-password-on="mousedown"
|
||||||
|
class="mb-3"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<n-icon :component="LockOutlined"/>
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
<n-button type="primary" :loading="submitting" @click="applySpell">
|
<n-button type="primary" :loading="submitting" @click="applySpell">
|
||||||
<template #icon><check-filled /></template>
|
<template #icon>
|
||||||
|
<check-filled/>
|
||||||
|
</template>
|
||||||
Apply
|
Apply
|
||||||
</n-button>
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<n-spin v-else size="small" />
|
<n-spin v-else size="small"/>
|
||||||
</n-card>
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NCard, NAlert, NSpin, NIcon, NButton, NInput } from 'naive-ui'
|
import {NCard, NAlert, NSpin, NIcon, NButton, NInput} from 'naive-ui'
|
||||||
import {
|
import {
|
||||||
AccountCircleOutlined,
|
AccountCircleOutlined,
|
||||||
PlayArrowFilled,
|
PlayArrowFilled,
|
||||||
DateRangeFilled,
|
DateRangeFilled,
|
||||||
CheckFilled,
|
CheckFilled,
|
||||||
|
LockOutlined
|
||||||
} from '@vicons/material'
|
} from '@vicons/material'
|
||||||
import { onMounted, ref } from 'vue'
|
import {onMounted, ref} from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import {useRoute} from 'vue-router'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -79,8 +99,8 @@ async function applySpell() {
|
|||||||
submitting.value = true
|
submitting.value = true
|
||||||
const resp = await fetch(`/api/spells/${encodeURIComponent(spellWord)}/apply`, {
|
const resp = await fetch(`/api/spells/${encodeURIComponent(spellWord)}/apply`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: newPassword.value ? JSON.stringify({ new_password: newPassword.value }) : null,
|
body: newPassword.value ? JSON.stringify({new_password: newPassword.value}) : null,
|
||||||
})
|
})
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
done.value = true
|
done.value = true
|
||||||
|
Reference in New Issue
Block a user