web sitesi yönetimi
This commit is contained in:
18
lib/data.ts
18
lib/data.ts
@@ -11,3 +11,21 @@ export const getProfile = cache(async (userId: string) => {
|
||||
|
||||
return data
|
||||
})
|
||||
|
||||
export const getSiteContents = cache(async () => {
|
||||
const supabase = createClient()
|
||||
const { data } = await supabase
|
||||
.from('site_contents')
|
||||
.select('*')
|
||||
|
||||
// Convert to a simpler key-value map for easier usage in components
|
||||
const contentMap: Record<string, string> = {}
|
||||
|
||||
if (data) {
|
||||
data.forEach((item: any) => {
|
||||
contentMap[item.key] = item.value
|
||||
})
|
||||
}
|
||||
|
||||
return contentMap
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user