update .vue

This commit is contained in:
Chen, Tai-Lin committed 2024-03-04 23:37:46 +08:00
1 parent af9b443865
commit f52017ef9f
14 files changed
+16 -127

No files matched your search

-4
View File
@@ -8,7 +8,6 @@ import { checkUsername, chooseUsername } from '../utils/auth'
async function check({ username, error }: { username: string; error: any }) {
if (username) {
if (!isValidUsername(username)) {
// error('Invalid username.')
error('無效的帳號名稱')
return
}
@@ -16,7 +15,6 @@ async function check({ username, error }: { username: string; error: any }) {
await checkUsername(username)
} catch (err) {
if (err instanceof TooManyRequestsError) {
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
@@ -24,7 +22,6 @@ async function check({ username, error }: { username: string; error: any }) {
error(err.message)
return
}
// error('Something went wrong. Please try again later.')
error('出了點問題,請再試一次。')
}
}
@@ -44,7 +41,6 @@ async function handleSubmit({
success()
} catch (err: any) {
if (err instanceof TooManyRequestsError) {
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
-4
View File
@@ -30,14 +30,10 @@ onMounted(async () => {
await init(props.questId)
} catch (err: any) {
if (err instanceof LoadQuestError) {
// toast.error(`Failed to load quest: ${err.questId}. Please check the URL.`)
toast.error(`無法讀取關卡: ${err.questId},請確認網頁連結。`)
return
}
if (err instanceof LoadSessionError) {
// toast.error(
// `Failed to create session for quest: ${err.questId}. Please re-login and try again.`
// )
toast.error(`無法建立工作階段: ${err.questId},請重新登入再試一次。`)
return
}
+2 -2
View File
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { Ref, ref, onMounted } from 'vue'
import { useToast } from 'vue-toastification'
import DynamicBackground from '../components/DynamicBackground.vue'
import GameHeaderPart from '../components/GameHeaderPart.vue'
import api from '../utils/api'
const leaderboard = ref([])
const leaderboard: Ref<any> = ref([])
const toast = useToast()
async function getLeaderboard() {
-4
View File
@@ -25,22 +25,18 @@ const handleLogin = async ({
if (isSuccess) success()
} catch (err) {
if (err instanceof TooManyRequestsError) {
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
if (err instanceof UnauthorizedError) {
// error('Wrong username or password.')
error('錯誤的帳號名稱或密碼。')
return
}
if (err instanceof ValidationError) {
// error('Invalid username or password.')
error('無效的帳號名稱或密碼。')
return
}
console.error(err)
// error('Something went wrong.')
error('出了點問題。')
}
}
-7
View File
@@ -6,13 +6,6 @@ import GameHeaderPart from '../components/GameHeaderPart.vue'
<template>
<div class="h-[6vh] w-full">
<GameHeaderPart title="關卡地圖" />
<!-- <p
class="text-text-primary absolute z-1 font-bold inline-block tracking-widest"
style="left: 1.2%; top: 1.5%; height: 100%; font-size: 2vh"
>
Quest Map
Unix編年史
</p> -->
</div>
<div class="flex flex-col justify-center items-center w-full h-[94vh]">
<QuestMap />
-10
View File
@@ -29,12 +29,10 @@ function handleRegister({
.then(success)
.catch((err) => {
if (err instanceof TooManyRequestsError) {
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
if (err instanceof UnauthorizedError) {
// error('Invalid username or password.')
error('無效的帳號名稱或密碼。')
return
}
@@ -43,7 +41,6 @@ function handleRegister({
return
}
console.error(err)
// error('Something went wrong.')
error('出了點問題。')
})
}
@@ -60,19 +57,14 @@ async function check({
error: any
}) {
if (username && !isValidUsername(username)) {
// error('Invalid username.')
error('無效的帳號名稱')
return
}
if (email && !validator.isEmail(email)) {
// error('Invalid email.')
error('無效的電子郵件')
return
}
if (password && !validator.isStrongPassword(password, passwordPolicy)) {
// error(
// 'Your password must be 8+ characters with at least one number, one upper and one lower case letter.'
// )
error('密碼必須超過8個字元,至少包含一個數字、一個大寫及一個小寫。')
return
}
@@ -84,12 +76,10 @@ async function check({
return
}
if (err instanceof TooManyRequestsError) {
// error('Too many requests. Try again in 2 minutes.')
error('太多請求,兩分鐘後再試一次。')
return
}
console.error(err)
// error('Something went wrong.')
error('出了點問題。')
}
}