Improve error handling
This commit is contained in:
@@ -26,9 +26,13 @@ const client = useClient();
|
|||||||
const contents = ref();
|
const contents = ref();
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
if (props.creatorId == null) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await client.get(`/api/contents/user/${props.creatorId}`)
|
const response = await client.get(`/api/contents/user/${props.creatorId}`)
|
||||||
|
if (response.status >= 200 && response.status < 300) {
|
||||||
contents.value = response.data
|
contents.value = response.data
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to fetch posts", error);
|
console.error("Failed to fetch posts", error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user