+
{{ watcher.name }}
diff --git a/frontend/src/pages/[user]/index.vue b/frontend/src/pages/[user]/index.vue
index 1341bd61..a0d6f83b 100644
--- a/frontend/src/pages/[user]/index.vue
+++ b/frontend/src/pages/[user]/index.vue
@@ -37,7 +37,8 @@ const props = defineProps<{
const i18n = useI18n();
const route = useRoute();
-const { starred, watching, projects, organizations, pinned } = (await useUserData(props.user.name)).value || {};
+const userData = await useUserData(props.user.name);
+const { starred, watching, projects, organizations, pinned } = userData.value || { starred: null };
let organizationVisibility = null;
if (props.user.name === useAuthStore().user?.name) {
organizationVisibility = await useOrgVisibility(props.user.name);
diff --git a/frontend/src/pages/admin/approval/versions.vue b/frontend/src/pages/admin/approval/versions.vue
index a028d768..567ef487 100644
--- a/frontend/src/pages/admin/approval/versions.vue
+++ b/frontend/src/pages/admin/approval/versions.vue
@@ -6,7 +6,6 @@ import { useRoute } from "vue-router";
import SortableTable, { Header } from "~/components/SortableTable.vue";
import { ReviewAction } from "~/types/enums";
import { useVersionApprovals } from "~/composables/useApiHelper";
-import { handleRequestError } from "~/composables/useErrorHandling";
import Card from "~/lib/components/design/Card.vue";
import Link from "~/lib/components/design/Link.vue";
import Tag from "~/components/Tag.vue";
@@ -20,7 +19,7 @@ definePageMeta({
const i18n = useI18n();
const route = useRoute();
-const data = await useVersionApprovals().catch((e) => handleRequestError(e));
+const data = await useVersionApprovals();
const actions = {
ongoing: [ReviewAction.START, ReviewAction.MESSAGE, ReviewAction.UNDO_APPROVAL, ReviewAction.REOPEN],
diff --git a/frontend/src/pages/admin/flags.vue b/frontend/src/pages/admin/flags.vue
index df43d11b..05a8f5f3 100644
--- a/frontend/src/pages/admin/flags.vue
+++ b/frontend/src/pages/admin/flags.vue
@@ -3,8 +3,6 @@ import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
import { ref } from "vue";
import { useHead } from "@vueuse/head";
-import { useUnresolvedFlags } from "~/composables/useApiHelper";
-import { handleRequestError } from "~/composables/useErrorHandling";
import PageTitle from "~/lib/components/design/PageTitle.vue";
import { useSeo } from "~/composables/useSeo";
import Flags from "~/components/Flags.vue";
@@ -17,7 +15,6 @@ definePageMeta({
const i18n = useI18n();
const route = useRoute();
-const flags = await useUnresolvedFlags().catch((e) => handleRequestError(e));
const loading = ref<{ [key: number]: boolean }>({});
const selectedTab = ref("unresolved");
diff --git a/frontend/src/pages/admin/health.vue b/frontend/src/pages/admin/health.vue
index a4829d47..0cd0f017 100644
--- a/frontend/src/pages/admin/health.vue
+++ b/frontend/src/pages/admin/health.vue
@@ -3,7 +3,6 @@ import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
import { useHead } from "@vueuse/head";
import { useHealthReport } from "~/composables/useApiHelper";
-import { handleRequestError } from "~/composables/useErrorHandling";
import Card from "~/lib/components/design/Card.vue";
import Link from "~/lib/components/design/Link.vue";
import PageTitle from "~/lib/components/design/PageTitle.vue";
@@ -16,7 +15,7 @@ definePageMeta({
const i18n = useI18n();
const route = useRoute();
-const healthReport = await useHealthReport().catch((e) => handleRequestError(e));
+const healthReport = await useHealthReport();
useHead(useSeo(i18n.t("health.title"), null, route, null));
diff --git a/frontend/src/pages/admin/log.vue b/frontend/src/pages/admin/log.vue
index ca4578e0..ccf50544 100644
--- a/frontend/src/pages/admin/log.vue
+++ b/frontend/src/pages/admin/log.vue
@@ -8,7 +8,6 @@ import { LoggedAction, LoggedActionType } from "hangar-internal";
import { debounce } from "lodash-es";
import PageTitle from "~/lib/components/design/PageTitle.vue";
import { useActionLogs } from "~/composables/useApiHelper";
-import { handleRequestError } from "~/composables/useErrorHandling";
import Card from "~/lib/components/design/Card.vue";
import SortableTable, { Header } from "~/components/SortableTable.vue";
import Link from "~/lib/components/design/Link.vue";
@@ -27,7 +26,7 @@ definePageMeta({
const i18n = useI18n();
const route = useRoute();
-const loggedActions = await useActionLogs().catch((e) => handleRequestError(e));
+const loggedActions = await useActionLogs();
// TODO add support for sorting
const headers = [
diff --git a/frontend/src/pages/admin/user/[user].vue b/frontend/src/pages/admin/user/[user].vue
index 1337a241..2cf600e5 100644
--- a/frontend/src/pages/admin/user/[user].vue
+++ b/frontend/src/pages/admin/user/[user].vue
@@ -15,7 +15,7 @@ import SortableTable, { Header } from "~/components/SortableTable.vue";
import InputCheckbox from "~/lib/components/ui/InputCheckbox.vue";
import { useSeo } from "~/composables/useSeo";
import { authUrl, forumUserUrl } from "~/composables/useUrlHelper";
-import { useUser } from "~/composables/useApiHelper";
+import { useProjects, useUser } from "~/composables/useApiHelper";
import Tag from "~/components/Tag.vue";
import InputSelect from "~/lib/components/ui/InputSelect.vue";
import { useBackendData } from "~/store/backendData";
@@ -30,13 +30,11 @@ const i18n = useI18n();
const route = useRoute();
const router = useRouter();
-const projects = await useApi
>("projects", "get", {
- owner: route.params.user,
-}).catch((e) => handleRequestError(e));
+const projects = await useProjects({ owner: route.params.user });
const orgs = await useInternalApi<{ [key: string]: OrganizationRoleTable }>(`organizations/${route.params.user}/userOrganizations`).catch((e) =>
handleRequestError(e)
);
-const user = await useUser(route.params.user as string).catch((e) => handleRequestError(e));
+const user = await useUser(route.params.user as string);
const projectsConfig = [
{ title: i18n.t("userAdmin.project"), name: "name" },
@@ -67,7 +65,7 @@ const selectedRole = ref();
async function processRole(add: boolean) {
try {
await useInternalApi("/admin/user/" + route.params.user + "/" + selectedRole.value, add ? "POST" : "DELETE");
- if (user) {
+ if (user?.value) {
user.value = await useApi(("users/" + route.params.user) as string);
}
} catch (e) {
@@ -90,7 +88,7 @@ useHead(useSeo(i18n.t("userAdmin.title") + " " + route.params.user, null, route,
{{ i18n.t("userAdmin.roles") }}
-
+
@@ -98,12 +96,12 @@ useHead(useSeo(i18n.t("userAdmin.title") + " " + route.params.user, null, route,
-
-
+
{{ i18n.t("general.delete") }}
diff --git a/frontend/src/pages/admin/user/index.vue b/frontend/src/pages/admin/user/index.vue
index 5f030e82..5e758b78 100644
--- a/frontend/src/pages/admin/user/index.vue
+++ b/frontend/src/pages/admin/user/index.vue
@@ -10,7 +10,7 @@ import Tag from "~/components/Tag.vue";
import { useApi } from "~/composables/useApi";
import { Header } from "~/components/SortableTable.vue";
import { useSeo } from "~/composables/useSeo";
-import { definePageMeta, handleRequestError, watch } from "#imports";
+import { definePageMeta, watch } from "#imports";
import { useUsers } from "~/composables/useApiHelper";
import InputCheckbox from "~/lib/components/ui/InputCheckbox.vue";
import InputText from "~/lib/components/ui/InputText.vue";
@@ -33,7 +33,7 @@ const headers = [
{ name: "org", title: i18n.t("pages.headers.organization"), sortable: true },
] as Header[];
-const users = await useUsers().catch((e) => handleRequestError(e));
+const users = await useUsers();
const page = ref(0);
const sort = ref([]);
const query = ref();
diff --git a/frontend/src/pages/authors.vue b/frontend/src/pages/authors.vue
index d430e6ee..8e8d42aa 100644
--- a/frontend/src/pages/authors.vue
+++ b/frontend/src/pages/authors.vue
@@ -32,7 +32,7 @@ const requestParams = computed(() => {
sort: sort.value,
};
});
-const authors = await useAuthors(requestParams.value).catch((e) => handleRequestError(e));
+const authors = await useAuthors(requestParams.value);
async function updateSort(col: string, sorter: Record) {
sort.value = [...Object.keys(sorter)]
diff --git a/frontend/src/pages/index.vue b/frontend/src/pages/index.vue
index 7a37a0e1..f75399ec 100644
--- a/frontend/src/pages/index.vue
+++ b/frontend/src/pages/index.vue
@@ -9,7 +9,6 @@ import InputCheckbox from "~/lib/components/ui/InputCheckbox.vue";
import { useBackendData, useVisibleCategories, useVisiblePlatforms } from "~/store/backendData";
import ProjectList from "~/components/projects/ProjectList.vue";
import { useProjects } from "~/composables/useApiHelper";
-import { handleRequestError } from "~/composables/useErrorHandling";
import Card from "~/lib/components/design/Card.vue";
import Container from "~/lib/components/design/Container.vue";
import { useSeo } from "~/composables/useSeo";
@@ -67,7 +66,7 @@ const requestParams = computed(() => {
return params;
});
-const p = await useProjects(requestParams.value).catch((e) => handleRequestError(e));
+const p = await useProjects(requestParams.value);
if (p && p.value) {
projects.value = p.value;
await checkOffsetLargerCount();
@@ -141,7 +140,7 @@ const script = {
if (isRef(meta.script)) {
meta.script.value.push(script);
} else {
- meta.script = meta.script || [];
+ meta.script = (meta.script || []) as [];
meta.script.push(script);
}
useHead(meta);
diff --git a/frontend/src/pages/notifications.vue b/frontend/src/pages/notifications.vue
index 6901318e..81b8835a 100644
--- a/frontend/src/pages/notifications.vue
+++ b/frontend/src/pages/notifications.vue
@@ -30,11 +30,11 @@ const route = useRoute();
const notificationStore = useNotificationStore();
// TODO send in one
-const unreadNotifications = (await useUnreadNotifications().catch((e) => handleRequestError(e))) as Ref>;
-const readNotifications = (await useReadNotifications().catch((e) => handleRequestError(e))) as Ref>;
-const allNotifications = (await useNotifications().catch((e) => handleRequestError(e))) as Ref>;
-const notifications: Ref> = ref(unreadNotifications.value);
-const invites = (await useInvites().catch((e) => handleRequestError(e))) as Ref;
+const unreadNotifications = await useUnreadNotifications();
+const readNotifications = await useReadNotifications();
+const allNotifications = await useNotifications();
+const notifications: Ref | null> = ref(unreadNotifications.value);
+const invites = await useInvites();
const selectedTab = ref("unread");
const selectedTabs: Tab[] = [
@@ -66,6 +66,7 @@ useHead(useSeo("Notifications", null, route, null));
async function markAllAsRead() {
await useInternalApi(`markallread`, "post").catch((e) => handleRequestError(e));
+ if (!unreadNotifications.value) return;
unreadNotifications.value.result = [];
unreadNotifications.value.pagination.limit = 0;
unreadNotifications.value.pagination.offset = 0;
@@ -75,6 +76,7 @@ async function markAllAsRead() {
async function markNotificationRead(notification: HangarNotification, router = true) {
await useInternalApi(`notifications/${notification.id}`, "post").catch((e) => handleRequestError(e));
notification.read = true;
+ if (!notifications.value) return;
notifications.value.result = notifications.value.result.filter((n) => n !== notification);
if (notification.action && router) {
await useRouter().push(notification.action);
@@ -86,6 +88,7 @@ async function updateInvite(invite: Invite, status: "accept" | "decline") {
if (status === "accept") {
invite.accepted = true;
} else {
+ if (!invites.value) return;
invites.value[invite.type] = invites.value[invite.type].filter((i) => i.roleTableId !== invite.roleTableId);
}
notificationStore.success(i18n.t(`notifications.invite.msgs.${status}`, [invite.name]));
@@ -112,11 +115,11 @@ function updateSelectedNotifications() {
-
+
{{ i18n.t(`notifications.empty.${selectedTab}`) }}
-
+
@@ -139,7 +142,7 @@ function updateSelectedNotifications() {
-
+
{{ i18n.t("notifications.readAll") }}
diff --git a/frontend/src/pages/staff.vue b/frontend/src/pages/staff.vue
index 90a7d54d..a6d26075 100644
--- a/frontend/src/pages/staff.vue
+++ b/frontend/src/pages/staff.vue
@@ -34,7 +34,7 @@ const requestParams = computed(() => {
sort: sort.value,
};
});
-const staff = await useStaff(requestParams.value).catch((e) => handleRequestError(e));
+const staff = await useStaff(requestParams.value);
async function updateSort(col: string, sorter: Record) {
sort.value = [...Object.keys(sorter)]