fix: frontend
This commit is contained in:
37
frontend/src/views/ChannelMessages.vue
Normal file
37
frontend/src/views/ChannelMessages.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<h1 class="mb-4 font-semibold text-xl">{{ channel.Title }}</h1>
|
||||
<ListItem v-for="item in items" :key="item.id" :item="item" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRoute } from "vue-router";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { channelMessages, channelInfo } from "../request";
|
||||
import ListItem from "../components/ListItem.vue";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const channel = ref({});
|
||||
const items = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
channelInfo(route.params.channel).then((resp) => {
|
||||
channel.value = resp.data;
|
||||
});
|
||||
|
||||
channelMessages(route.params.channel).then((resp) => {
|
||||
let data = resp.data;
|
||||
data.map((item) => {
|
||||
let media = item.Media.replace(/"asset_id":\s(\d+)/g, (match, p1, p2, p3, offset, string) => {
|
||||
return `"asset_id": "${p1}"`
|
||||
})
|
||||
|
||||
item.Media = JSON.parse(media).filter((item) => {
|
||||
return Object.keys(item).length > 0;
|
||||
});
|
||||
console.log(item);
|
||||
});
|
||||
items.value = data;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user