Skip to content

Commit

Permalink
LintFix
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdubs committed Jan 24, 2024
1 parent a1a9142 commit 8d896d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
13 changes: 1 addition & 12 deletions frontend/app.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<script setup lang="ts">
import { serializeError } from 'serialize-error'
const { loading: { clearLoading }, error: { errorModalVisible, error } } = useModal()
const handleError = (err: Error) => {
if (process.client) {
console.log(err)
}
error.value = serializeError(err)
errorModalVisible.value = true
clearLoading()
}
const { error: { handleError } } = useModal()
onErrorCaptured((err: unknown, _instance: ComponentPublicInstance | null, _info: string) => {
let error: Error | undefined
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/portfolio/DownloadButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type Portfolio, type AccessBlobContentResp } from '@/openapi/generated/
const { t } = useI18n()
const pactaClient = usePACTA()
const { error: { handleError } } = useModal()
interface Props {
portfolio: Portfolio
Expand All @@ -17,7 +18,7 @@ const downloadInProgress = useState<boolean>(`${statePrefix}.downloadInProgress`
const doDownload = async () => {
const blob = props.portfolio.blob
if (!blob) {
console.warn('No blobId found for portfolio', props.portfolio)
handleError(new Error(`Portfolio did not have blob associated with it, and could not be downloaded: ${props.portfolio.id}`))
return
}
const blobId = blob.id
Expand Down
10 changes: 10 additions & 0 deletions frontend/composables/useModal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Ref } from 'vue'
import { type ErrorObject } from 'serialize-error'
import { serializeError } from 'serialize-error'

export const useModal = () => {
const prefix = 'useModal'
Expand All @@ -24,6 +25,14 @@ export const useModal = () => {
// error
const errorModalVisible = newModalVisibilityState('errorModalVisible')
const error = useState<ErrorObject>('errorModal.error')
const handleError = (err: Error) => {
if (process.client) {
console.log(err)
}
error.value = serializeError(err)
errorModalVisible.value = true
clearLoading()
}

// loading
const loadingSet = useState<Set<string>>(`${prefix}.loadingSet`, () => new Set<string>())
Expand Down Expand Up @@ -86,6 +95,7 @@ export const useModal = () => {
error: {
error,
errorModalVisible,
handleError,
},
permissionDenied: {
permissionDeniedVisible,
Expand Down

0 comments on commit 8d896d1

Please sign in to comment.