Skip to content

A self-hosted media server and file management system

chore: code smells

aminnausin19261f463fd6
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vue
index 3d5f4339..e7f7e970 100755
--- a/resources/js/components/table/TableBase.vue
+++ b/resources/js/components/table/TableBase.vue
@@ -64,7 +64,7 @@ onMounted(() => {
<template>
<!-- [&>*:not(:first-child)]:pt-4 -->
- <table class="flex flex-col gap-4">
+ <section class="flex flex-col gap-4">
<section v-if="props.useToolbar" class="flex justify-center sm:justify-between flex-col sm:flex-row gap-2">
<TextInputLabelled
v-model="tableData.fields.searchQuery"
@@ -105,7 +105,7 @@ onMounted(() => {
</ButtonIcon>
</span>
</section>
- <tbody :class="`${useGrid ? useGrid : `flex w-full flex-wrap gap-2 ${tableStyles ?? ''}`}`">
+ <section :class="`${useGrid ? useGrid : `flex w-full flex-wrap gap-2 ${tableStyles ?? ''}`}`">
<div
v-if="loading || tableData.filteredPage.length === 0"
class="col-span-full flex items-center justify-center text-center text-lg text-gray-500 dark:text-gray-400 uppercase tracking-wider w-full gap-2"
@@ -125,7 +125,7 @@ onMounted(() => {
@clickAction="(...args: any[]) => props.clickAction?.(row?.id, ...args)"
@otherAction="(...args: any[]) => props.otherAction?.(row?.id, ...args)"
></component>
- </tbody>
+ </section>
<!-- <hr class="p-0" /> -->
<TablePagination
v-if="usePagination"
@@ -135,5 +135,5 @@ onMounted(() => {
:currentPage="tableData.fields.currentPage"
@setPage="tableData.handlePageChange"
/>
- </table>
+ </section>
</template>
diff --git a/resources/js/components/video/VideoAmbientPlayer.vue b/resources/js/components/video/VideoAmbientPlayer.vue
index 46b14524..6666d9c4 100755
--- a/resources/js/components/video/VideoAmbientPlayer.vue
+++ b/resources/js/components/video/VideoAmbientPlayer.vue
@@ -119,6 +119,7 @@ watch(
width="6"
:height="isAudio ? '6' : '4'"
aria-hidden="true"
+ tabindex="-1"
class="absolute opacity-100 blur-xl pointer-events-none w-full h-full"
ref="canvas"
>
diff --git a/resources/js/components/video/VideoPartyItem.vue b/resources/js/components/video/VideoPartyItem.vue
index c8075c8f..f569ba85 100644
--- a/resources/js/components/video/VideoPartyItem.vue
+++ b/resources/js/components/video/VideoPartyItem.vue
@@ -36,7 +36,7 @@ const emits = defineEmits<{
<img
class="h-4 w-4 rounded-full object-cover aspect-square"
:src="`https://ui-avatars.com/api/?name=${user.name[0] ?? 'a'}&amp;color=7F9CF5&amp;background=random`"
- :alt="'user profile picture'"
+ :alt="'user profile'"
/>
</span>
</section>
diff --git a/resources/js/service/authAPI.ts b/resources/js/service/authAPI.ts
index 9bbbf9b2..ccbff943 100644
--- a/resources/js/service/authAPI.ts
+++ b/resources/js/service/authAPI.ts
@@ -10,7 +10,7 @@ export const login = async (credentials: any) => {
const response = await API.post('/login', credentials);
return Promise.resolve(response);
} catch (error) {
- return Promise.reject(error);
+ throw error instanceof Error ? error : new Error(String(error));
}
};
@@ -19,7 +19,7 @@ export const register = async (credentials: any) => {
const response = await API.post('/register', credentials);
return Promise.resolve(response);
} catch (error) {
- return Promise.reject(error);
+ throw error instanceof Error ? error : new Error(String(error));
}
};
@@ -29,7 +29,7 @@ export const logout = async () => {
const { data } = response;
return Promise.resolve({ response: data });
} catch (error) {
- return Promise.reject({ error });
+ throw error instanceof Error ? error : new Error(String(error));
}
};
@@ -41,6 +41,6 @@ export const authenticate = async (token: string | null) => {
},
});
} catch (error) {
- return Promise.reject({ error });
+ throw error instanceof Error ? error : new Error(String(error));
}
};
diff --git a/resources/js/stores/ContentStore.js b/resources/js/stores/ContentStore.js
index a950d799..cc0f2c41 100755
--- a/resources/js/stores/ContentStore.js
+++ b/resources/js/stores/ContentStore.js
@@ -139,7 +139,7 @@ export const useContentStore = defineStore('Content', () => {
if (error || !data?.success) {
console.log(error ?? data?.message);
- return Promise.reject([]);
+ return Promise.reject(error ?? data?.message);
}
stateRecords.value = data?.data ?? []; // always overwrite because if limit is set and results cached, no request is made. Otherwise its a full request.
@@ -223,7 +223,7 @@ export const useContentStore = defineStore('Content', () => {
if (error || !data?.success) {
console.log(error ?? data?.message);
- return Promise.reject([]);
+ return Promise.reject(error ?? data?.message);
}
stateVideo.value.view_count += 1;
return Promise.resolve(stateVideo.value);
@@ -236,7 +236,7 @@ export const useContentStore = defineStore('Content', () => {
if (error || !data?.success) {
console.log(error ?? data?.message);
- return Promise.reject([]);
+ return Promise.reject(error ?? data?.message);
}
stateRecords.value = [data?.data, ...stateRecords.value];
return Promise.resolve(stateRecords.value);