Reworking the layouts to allow for the new design
This commit is contained in:
41
src/views/creators/CreatorContent.vue
Normal file
41
src/views/creators/CreatorContent.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<h1>Content Browser</h1>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script async setup>
|
||||
import {watch, ref, onBeforeMount} from 'vue';
|
||||
import {useRoute} from 'vue-router';
|
||||
import {useClient} from "@/plugins/api.js";
|
||||
|
||||
const creator = ref(null)
|
||||
const loading = ref(true)
|
||||
const contents = ref([])
|
||||
|
||||
const client = useClient()
|
||||
const route = useRoute()
|
||||
|
||||
function contentPosted(content) {
|
||||
contents.value.unshift(content)
|
||||
}
|
||||
|
||||
onBeforeMount(async () => await fetchCreatorData(route.params.creator))
|
||||
|
||||
watch(
|
||||
() => route.params.creator,
|
||||
async () => await fetchCreatorData(route.params.creator)
|
||||
)
|
||||
|
||||
const fetchCreatorData = async (creatorAlias) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const response = await client.get(`/api/creators/@${creatorAlias}`)
|
||||
creator.value = response.data
|
||||
} catch (error) {
|
||||
console.error(`Error fetching content: ${error}`)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user