💚 Fixes CI web build
This commit is contained in:
parent
c4f2006e8f
commit
8068f82f13
@ -26,7 +26,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Bun 1.2.0
|
||||
run: oven-sh/setup-bun@v2
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.2.0
|
||||
- name: Display Bun version
|
||||
|
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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user