🐳 Adds dockerfile
This commit is contained in:
@@ -37,33 +37,17 @@ const toast = useToast()
|
||||
|
||||
async function onSubmit(event: FormSubmitEvent<Schema>) {
|
||||
const received = event.data.token
|
||||
await $fetch("https://door.svitan.dev/open", {
|
||||
await $fetch(useAPI("/open"), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${received}`,
|
||||
},
|
||||
async onRequestError({ error }) {
|
||||
toast.add({
|
||||
title: "Error occurred",
|
||||
description: error.message,
|
||||
color: "error",
|
||||
})
|
||||
},
|
||||
async onResponse({ response }) {
|
||||
if (response.status === 200) {
|
||||
toast.add({ title: "Token saved", color: "success" })
|
||||
token.value = received
|
||||
navigateTo("/")
|
||||
} else if (response.status === 401) {
|
||||
toast.add({ title: "Token not valid", color: "error" })
|
||||
} else {
|
||||
toast.add({
|
||||
title: "Error occurred",
|
||||
description: await response.text(),
|
||||
color: "error",
|
||||
})
|
||||
}
|
||||
},
|
||||
onRequestError: handleRequestError,
|
||||
onResponse: handleResponse(() => {
|
||||
toast.add({ title: "Token saved", color: "success" })
|
||||
token.value = received
|
||||
navigateTo("/")
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user