Improve error handling

This commit is contained in:
Jonathan Bourdon
2024-07-02 01:42:41 -04:00
parent d2d9366700
commit cb02cce5b4

View File

@@ -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);
}