💚 Fixes CI web build
This commit is contained in:
3
web/composables/useToken.ts
Normal file
3
web/composables/useToken.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function useToken() {
|
||||
return useCookie<string | undefined>("token")
|
||||
}
|
@@ -6,7 +6,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const token = useCookie("token")
|
||||
const token = useToken()
|
||||
|
||||
onMounted(() => {
|
||||
if (!token.value) {
|
||||
|
@@ -16,6 +16,8 @@
|
||||
import * as v from "valibot"
|
||||
import type { FormSubmitEvent } from "@nuxt/ui"
|
||||
|
||||
const token = useCookie("token")
|
||||
|
||||
const schema = v.object({
|
||||
token: v.pipe(v.string(), v.nonEmpty("Please enter your token"))
|
||||
})
|
||||
@@ -39,4 +41,10 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
|
||||
console.log(res)
|
||||
toast.add({ title: "Token saved", color: "success" })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (token.value) {
|
||||
return navigateTo("/")
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user