Merge remote-tracking branch 'origin/jo-wip' into jo-wip
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import {createApp} from 'vue'
|
import {createApp} from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router/router.js'
|
||||||
import './assets/main.css'
|
import './assets/main.css'
|
||||||
import {createPinia} from 'pinia'
|
import {createPinia} from 'pinia'
|
||||||
import '@mdi/font/css/materialdesignicons.css'
|
import '@mdi/font/css/materialdesignicons.css'
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<v-infinite-scroll :items="contents"
|
<v-infinite-scroll :items="contents"
|
||||||
:onLoad="load">
|
:onLoad="fetchContents">
|
||||||
|
|
||||||
<template v-for="content in contents">
|
<template v-for="content in contents">
|
||||||
<ContentCard :content="content"
|
<content-card :content="content"
|
||||||
class="w-full p-2 my-2"
|
class="w-full p-2 my-2"
|
||||||
>
|
></content-card>
|
||||||
</ContentCard>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:empty>
|
<template v-slot:empty>
|
||||||
@@ -20,14 +19,12 @@
|
|||||||
|
|
||||||
</v-infinite-scroll>
|
</v-infinite-scroll>
|
||||||
|
|
||||||
<p class="bg-orange">test</p>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import {useClient} from '@/plugins/api.js';
|
import {useClient} from '@/plugins/api.js';
|
||||||
import {ref} from 'vue';
|
import {ref, watch} from 'vue';
|
||||||
import ContentCard from "./ContentCard.vue";
|
import ContentCard from "./ContentCard.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -43,7 +40,23 @@ const page_size = 10
|
|||||||
const errorMessage = ref()
|
const errorMessage = ref()
|
||||||
let last_id = null
|
let last_id = null
|
||||||
|
|
||||||
async function load({done}) {
|
const creatorIdWatcher = watch(
|
||||||
|
() => props.creatorId,
|
||||||
|
(newCreatorId) => {
|
||||||
|
if (newCreatorId) {
|
||||||
|
// Reset contents and last_id when the creatorId changes
|
||||||
|
contents.value = [];
|
||||||
|
last_id = null;
|
||||||
|
// Fetch contents for the new creator
|
||||||
|
fetchContents({
|
||||||
|
done: () => {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{immediate: true})
|
||||||
|
|
||||||
|
async function fetchContents({done}) {
|
||||||
try {
|
try {
|
||||||
let uri = `/api/contents/creator/${props.creatorId}?page_size=${page_size}`
|
let uri = `/api/contents/creator/${props.creatorId}?page_size=${page_size}`
|
||||||
if (last_id !== null) uri = uri + `&last_id=${last_id}`
|
if (last_id !== null) uri = uri + `&last_id=${last_id}`
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div v-if="creator && creator.id">
|
<div v-if="creator && creator.id">
|
||||||
|
|
||||||
<creator-banner :creator="creator"></creator-banner>
|
<creator-banner :creator="creator"></creator-banner>
|
||||||
|
|
||||||
<donation-popup :creator-id="creator.id"></donation-popup>
|
<donation-popup :creator-id="creator.id"></donation-popup>
|
||||||
|
|
||||||
<div class="max-w-[1000px] mx-auto flex flex-row justify-center border-l-2 border-r-2 -mt-6 ">
|
<div class="max-w-[1000px] mx-auto flex flex-row justify-center border-l-2 border-r-2 -mt-6 ">
|
||||||
@@ -43,32 +44,22 @@ const route = useRoute();
|
|||||||
const creator = ref(null);
|
const creator = ref(null);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => await fetchCreatorData(route.params.creator))
|
||||||
setTimeout(() => {
|
|
||||||
loading.value = false;
|
|
||||||
}, 1500);
|
|
||||||
await fetchCreatorData(route.params.creator);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.creator,
|
() => route.params.creator,
|
||||||
async () => {
|
async () => await fetchCreatorData(route.params.creator)
|
||||||
loading.value = true;
|
)
|
||||||
setTimeout(() => {
|
|
||||||
loading.value = false;
|
|
||||||
}, 1000);
|
|
||||||
await fetchCreatorData(route.params.creator);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const fetchCreatorData = async (creatorAlias) => {
|
const fetchCreatorData = async (creatorAlias) => {
|
||||||
try {
|
try {
|
||||||
|
loading.value = true
|
||||||
const response = await client.get(`/api/creators/@${creatorAlias}`)
|
const response = await client.get(`/api/creators/@${creatorAlias}`)
|
||||||
creator.value = response.data;
|
creator.value = response.data
|
||||||
console.log('loaded the following creator from api');
|
|
||||||
console.table(creator.value.id);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching content: ${error}`);
|
console.error(`Error fetching content: ${error}`)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<v-btn variant="plain"> Guide pour les créateurs</v-btn>
|
<v-btn variant="plain"> Guide pour les créateurs</v-btn>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link to="/termsandconditions">
|
<router-link to="/termsandconditions">
|
||||||
<v-btn variant="plain"> TermsAndConditions </v-btn>
|
<v-btn variant="plain">Termes et Conditions </v-btn>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link to="/contentpolicy">
|
<router-link to="/contentpolicy">
|
||||||
<v-btn variant="plain"> Politique de Contenu </v-btn>
|
<v-btn variant="plain"> Politique de Contenu </v-btn>
|
||||||
|
|||||||
Reference in New Issue
Block a user