-
+
($touched.name = true)}
label="Name"
- placeholder={`${$auth.user.firstName}'s first app`}
+ placeholder={$auth.user.firstName
+ ? `${$auth.user.firstName}'s app`
+ : "My app"}
/>
{/if}
diff --git a/packages/builder/src/components/start/UpdateAppModal.svelte b/packages/builder/src/components/start/UpdateAppModal.svelte
index 83b5710db8..432b13c7c3 100644
--- a/packages/builder/src/components/start/UpdateAppModal.svelte
+++ b/packages/builder/src/components/start/UpdateAppModal.svelte
@@ -77,7 +77,7 @@
async function updateApp() {
try {
// Update App
- await apps.update(app.instance._id, $values.name.trim())
+ await apps.update(app.instance._id, { name: $values.name.trim() })
hide()
} catch (error) {
console.error(error)
diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte
index 93dd68c70a..d7c9e91aed 100644
--- a/packages/builder/src/pages/builder/portal/apps/index.svelte
+++ b/packages/builder/src/pages/builder/portal/apps/index.svelte
@@ -366,8 +366,7 @@
{#each filteredApps as app (app.appId)}
- {
- const updatedAppIndex = state.findIndex(
- app => app.instance._id === appId
- )
-
- if (updatedAppIndex !== -1) {
- const updatedApp = state[updatedAppIndex]
- updatedApp.icon = icon
- state.apps = state.splice(updatedAppIndex, 1, updatedApp)
- }
-
- return state
- })
- } else {
- throw new Error("Error updating icon")
- }
- }
-
- async function update(appId, name) {
- const response = await api.put(`/api/applications/${appId}`, { name })
+ async function update(appId, value) {
+ console.log({ value })
+ const response = await api.put(`/api/applications/${appId}`, { ...value })
if (response.status === 200) {
store.update(state => {
const updatedAppIndex = state.findIndex(
app => app.instance._id === appId
)
if (updatedAppIndex !== -1) {
- const updatedApp = state[updatedAppIndex]
- updatedApp.name = name
+ let updatedApp = state[updatedAppIndex]
+ updatedApp = { ...updatedApp, ...value }
state.apps = state.splice(updatedAppIndex, 1, updatedApp)
}
return state
@@ -109,7 +89,6 @@ export function createAppStore() {
subscribe: store.subscribe,
load,
update,
- updateIcon,
}
}