💚 Fixes CI web build
This commit is contained in:
parent
c4f2006e8f
commit
8068f82f13
@ -26,7 +26,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Bun 1.2.0
|
- name: Setup Bun 1.2.0
|
||||||
run: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: 1.2.0
|
bun-version: 1.2.0
|
||||||
- name: Display Bun version
|
- 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>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const token = useCookie("token")
|
const token = useToken()
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!token.value) {
|
if (!token.value) {
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
import * as v from "valibot"
|
import * as v from "valibot"
|
||||||
import type { FormSubmitEvent } from "@nuxt/ui"
|
import type { FormSubmitEvent } from "@nuxt/ui"
|
||||||
|
|
||||||
|
const token = useCookie("token")
|
||||||
|
|
||||||
const schema = v.object({
|
const schema = v.object({
|
||||||
token: v.pipe(v.string(), v.nonEmpty("Please enter your token"))
|
token: v.pipe(v.string(), v.nonEmpty("Please enter your token"))
|
||||||
})
|
})
|
||||||
@ -39,4 +41,10 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
|
|||||||
console.log(res)
|
console.log(res)
|
||||||
toast.add({ title: "Token saved", color: "success" })
|
toast.add({ title: "Token saved", color: "success" })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (token.value) {
|
||||||
|
return navigateTo("/")
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user