Skip to content

Commit

Permalink
refactor(BcDataWrapper): get rid of console warnings
Browse files Browse the repository at this point in the history
`useAsyncData` should never return `undefined`
  • Loading branch information
marcel-bitfly committed Nov 4, 2024
1 parent be539a9 commit 4144088
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions frontend/stores/useLatestStateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ export function useLatestStateStore() {

const latestState = computed(() => data.value)

async function refreshLatestState(): Promise<LatestStateData | undefined> {
async function refreshLatestState() {
try {
const res = await fetch<InternalGetLatestStateResponse>(
API_PATH.LATEST_STATE,
)
if (!res.data) {
return undefined
return null
}
data.value = res.data
return data.value
}
catch {
return undefined
return null
}
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/stores/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function useUserStore() {
data.value = user
}

async function getUser(): Promise<undefined | UserInfo> {
async function getUser() {
try {
const res = await fetch<InternalGetUserInfoResponse>(
API_PATH.USER,
Expand All @@ -37,7 +37,7 @@ export function useUserStore() {
}
catch {
setUser(undefined)
return undefined
return null
}
}

Expand Down

0 comments on commit 4144088

Please sign in to comment.