Update usages of app metadata calls

This commit is contained in:
Andrew Kingston 2024-11-26 10:32:50 +00:00
parent a26eb57115
commit a7873caca8
No known key found for this signature in database
4 changed files with 6 additions and 24 deletions

View File

@ -35,10 +35,7 @@ export class NavigationStore extends BudiStore {
async save(navigation) { async save(navigation) {
const appId = get(appStore).appId const appId = get(appStore).appId
const app = await API.saveAppMetadata({ const app = await API.saveAppMetadata(appId, { navigation })
appId,
metadata: { navigation },
})
this.syncAppNavigation(app.navigation) this.syncAppNavigation(app.navigation)
} }

View File

@ -14,19 +14,13 @@ const createsnippets = () => {
...get(store).filter(snippet => snippet.name !== updatedSnippet.name), ...get(store).filter(snippet => snippet.name !== updatedSnippet.name),
updatedSnippet, updatedSnippet,
] ]
const app = await API.saveAppMetadata({ const app = await API.saveAppMetadata(get(appStore).appId, { snippets })
appId: get(appStore).appId,
metadata: { snippets },
})
syncMetadata(app) syncMetadata(app)
} }
const deleteSnippet = async snippetName => { const deleteSnippet = async snippetName => {
const snippets = get(store).filter(snippet => snippet.name !== snippetName) const snippets = get(store).filter(snippet => snippet.name !== snippetName)
const app = await API.saveAppMetadata({ const app = await API.saveAppMetadata(get(appStore).appId, { snippets })
appId: get(appStore).appId,
metadata: { snippets },
})
syncMetadata(app) syncMetadata(app)
} }

View File

@ -20,10 +20,7 @@ export const createThemeStore = () => {
} }
const save = async (theme, appId) => { const save = async (theme, appId) => {
const app = await API.saveAppMetadata({ const app = await API.saveAppMetadata(appId, { theme })
appId,
metadata: { theme },
})
store.update(state => { store.update(state => {
state.theme = app.theme state.theme = app.theme
return state return state
@ -32,10 +29,7 @@ export const createThemeStore = () => {
const saveCustom = async (theme, appId) => { const saveCustom = async (theme, appId) => {
const updated = { ...get(store).customTheme, ...theme } const updated = { ...get(store).customTheme, ...theme }
const app = await API.saveAppMetadata({ const app = await API.saveAppMetadata(appId, { customTheme: updated })
appId,
metadata: { customTheme: updated },
})
store.update(state => { store.update(state => {
state.customTheme = app.customTheme state.customTheme = app.customTheme
return state return state

View File

@ -128,10 +128,7 @@ export class AppsStore extends BudiStore {
} }
async save(appId, value) { async save(appId, value) {
await API.saveAppMetadata({ await API.saveAppMetadata(appId, value)
appId,
metadata: value,
})
this.update(state => { this.update(state => {
const updatedAppIndex = state.apps.findIndex( const updatedAppIndex = state.apps.findIndex(
app => app.instance._id === appId app => app.instance._id === appId