Working on arthome

This commit is contained in:
2024-08-25 18:33:37 +02:00
parent a5120d006a
commit a1e31a89a7
49 changed files with 3139 additions and 284 deletions

View File

@@ -1,10 +0,0 @@
export async function isAuthorized() {
const { user } = useUserSession()
const { data: authorized } = await useFetch('/api/authorized', {
method: 'POST',
body: {
email: user.value?.email ?? 'test@nuxt.com',
},
})
return authorized.value
}

View File

@@ -0,0 +1,13 @@
export function useCategories() {
async function getCategories() {
return useAsyncData<CategoryType[]>(async () => {
const res = await $fetch('/api/categories')
console.log('res', res)
return res
})
}
return {
getCategories,
}
}

21
app/composables/tabs.ts Normal file
View File

@@ -0,0 +1,21 @@
export function useTabs() {
async function createTab(tab: TabType) {
console.log('createTab', tab)
return tab
}
async function deleteTab(tab: TabType) {
console.log('deleteTab', tab)
return tab
}
async function updateTab(tab: TabType) {
console.log('updateTab', tab)
return tab
}
return {
createTab,
deleteTab,
}
}

21
app/composables/toasts.ts Normal file
View File

@@ -0,0 +1,21 @@
export function useSuccessToast(title: string, description?: string) {
const toast = useToast()
toast.add({
title,
description,
color: 'green',
icon: 'i-ph:check-circle-duotone',
})
}
export function useErrorToast(title: string, description?: string) {
const toast = useToast()
toast.add({
title,
description,
color: 'red',
icon: 'i-ph:x-circle-duotone',
})
}

View File

@@ -0,0 +1,22 @@
export function useUserLimit() {
function hasUserFreePlan() {
return true
}
function getRemainingCategories() {
if (!hasUserFreePlan())
return -1
return 3
}
function getRemainingTabs(category_id: number) {
if (!hasUserFreePlan())
return -1
return category_id * 3
}
return {
getRemainingCategories,
getRemainingTabs,
}
}