Copy pasta issues

This commit is contained in:
2026-07-09 22:24:31 -07:00
parent 0689f01a1e
commit 6b55864e22
12 changed files with 132 additions and 34 deletions
+85
View File
@@ -0,0 +1,85 @@
import http from "@/api/http-client"
import { type Policy } from "@/api/base-api"
// Keep in sync with api/src/models/notification.ts
export enum NotificationSourceTypes {
SYSTEM = "system",
}
export type Notification = {
id: number
userId: number
isRead: boolean
readDate: string | null
title: string
subtitle: string | null
href: string | null
sourceType: NotificationSourceTypes
createdAt: string
updatedAt: string
}
export type NotificationWhereOptions = {
userId?: number
isRead?: boolean
sourceType?: NotificationSourceTypes
}
export type NotificationFiltersOptions = {
createdTodayInUserTimezone?: string
}
export const notificationsApi = {
async list(
params: {
where?: NotificationWhereOptions
filters?: NotificationFiltersOptions
page?: number
perPage?: number
} = {}
): Promise<{
notifications: Notification[]
totalCount: number
}> {
const { data } = await http.get("/api/notifications", {
params,
})
return data
},
async get(notificationId: number): Promise<{
notification: Notification
policy: Policy
}> {
const { data } = await http.get(`/api/notifications/${notificationId}`)
return data
},
async create(attributes: Partial<Notification>): Promise<{
notification: Notification
}> {
const { data } = await http.post("/api/notifications", attributes)
return data
},
async update(
notificationId: number,
attributes: Partial<Notification>
): Promise<{
notification: Notification
}> {
const { data } = await http.patch(`/api/notifications/${notificationId}`, attributes)
return data
},
async delete(notificationId: number): Promise<void> {
const { data } = await http.delete(`/api/notifications/${notificationId}`)
return data
},
// Special actions
async markAll({ isRead }: { isRead: boolean }): Promise<void> {
const { data } = await http.post("/api/notifications/mark-all", {
isRead,
})
return data
},
}
export default notificationsApi
@@ -46,7 +46,7 @@
import { computed } from "vue"
import { useDisplay } from "vuetify"
import HeaderActionsCard from "@/components/shared/cards/HeaderActionsCard.vue"
import HeaderActionsCard from "@/components/common/HeaderActionsCard.vue"
const props = withDefaults(
defineProps<{
+1 -1
View File
@@ -48,7 +48,7 @@
</template>
<script lang="ts" setup>
import SplashImage from "@/assets/SplashImage.png"
import SplashImage from "@/assets/app_logo_splash.png"
import { useAuth0 } from "@auth0/auth0-vue"
import { APPLICATION_NAME } from "@/config"
@@ -48,7 +48,7 @@
</template>
<script lang="ts" setup>
import SplashImage from "@/assets/SplashImage.png"
import SplashImage from "@/assets/app_logo_splash.png"
import { useAuth0 } from "@auth0/auth0-vue"
import { APPLICATION_NAME } from "@/config"
+1 -1
View File
@@ -48,7 +48,7 @@
</template>
<script lang="ts" setup>
import SplashImage from "@/assets/SplashImage.png"
import SplashImage from "@/assets/app_logo_splash.png"
import { useAuth0 } from "@auth0/auth0-vue"
import { APPLICATION_NAME } from "@/config"
+1 -1
View File
@@ -48,7 +48,7 @@
</template>
<script lang="ts" setup>
import SplashImage from "@/assets/SplashImage.png"
import SplashImage from "@/assets/app_logo_splash.png"
import { useAuth0 } from "@auth0/auth0-vue"
import { APPLICATION_NAME } from "@/config"
-1
View File
@@ -6,7 +6,6 @@
// Styles
import "@mdi/font/css/materialdesignicons.css"
import "vuetify/styles"
// ComposablesF
import { createVuetify } from "vuetify"
-26
View File
@@ -66,31 +66,6 @@ export function useUser(id: Ref<number | null | undefined>) {
}
}
async function directorySync() {
const staticId = unref(id)
if (isNil(staticId)) {
throw new Error("id is required")
}
if (isNil(state.user)) {
throw new Error("No user to save")
}
state.isLoading = true
try {
const { user } = await usersApi.directorySync(staticId)
state.isErrored = false
state.user = user
return user
} catch (error) {
console.error("Failed to sync user:", error)
state.isErrored = true
throw error
} finally {
state.isLoading = false
}
}
watch(
() => unref(id),
async (newId) => {
@@ -106,7 +81,6 @@ export function useUser(id: Ref<number | null | undefined>) {
fetch,
refresh: fetch,
save,
directorySync,
}
}