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