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) {
const appId = get(appStore).appId
const app = await API.saveAppMetadata({
appId,
metadata: { navigation },
})
const app = await API.saveAppMetadata(appId, { navigation })
this.syncAppNavigation(app.navigation)
}

View File

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

View File

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

View File

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