Update other usages of auth store

This commit is contained in:
Andrew Kingston 2024-12-13 15:19:53 +00:00
parent d72e5f1812
commit f9dc834202
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import { AppStatus } from "constants"
import { API } from "api" import { API } from "api"
import { auth } from "./auth" import { auth } from "./auth"
import BudiStore from "../BudiStore" import BudiStore from "../BudiStore"
import { App, UpdateAppRequest, User } from "@budibase/types" import { App, UpdateAppRequest } from "@budibase/types"
interface AppIdentifierMetadata { interface AppIdentifierMetadata {
devId?: string devId?: string
@ -174,7 +174,7 @@ export class AppsStore extends BudiStore<PortalAppsStore> {
export const appsStore = new AppsStore() export const appsStore = new AppsStore()
export const sortBy = derived([appsStore, auth], ([$store, $auth]) => { export const sortBy = derived([appsStore, auth], ([$store, $auth]) => {
return $store.sortBy || ($auth.user as User | null)?.appSort || "name" return $store.sortBy || $auth.user?.appSort || "name"
}) })
// Centralise any logic that enriches the apps list // Centralise any logic that enriches the apps list
@ -182,7 +182,7 @@ export const enrichedApps = derived(
[appsStore, auth, sortBy], [appsStore, auth, sortBy],
([$store, $auth, $sortBy]) => { ([$store, $auth, $sortBy]) => {
const enrichedApps: EnrichedApp[] = $store.apps.map(app => { const enrichedApps: EnrichedApp[] = $store.apps.map(app => {
const user = $auth.user as User | null const user = $auth.user
return { return {
...app, ...app,
deployed: app.status === AppStatus.DEPLOYED, deployed: app.status === AppStatus.DEPLOYED,