1
0
Fork 0
mirror of synced 2024-07-03 13:30:46 +12:00

fix lint issue

This commit is contained in:
Maurits Lourens 2021-07-28 00:09:15 +02:00
parent c84cf22129
commit c9dd9594bc
3 changed files with 18 additions and 20 deletions

View file

@ -20,11 +20,11 @@
name: string().required("Your application must have a name"),
}
export let app;
export let app
let modal;
let modal
let valid = false
let dirty = false;
let dirty = false
$: checkValidity($values, validator)
$: {
// prevent validation by setting name to undefined without an app
@ -65,8 +65,8 @@
async function updateApp() {
try {
// Update App
await apps.update(app.instance._id, $values.name);
hide();
await apps.update(app.instance._id, $values.name)
hide()
} catch (error) {
console.error(error)
notifications.error(error)
@ -81,14 +81,14 @@
}
const onCancel = () => {
hide();
hide()
}
const onShow = () => {
dirty = false;
dirty = false
}
</script>
<Modal bind:this={modal} on:hide={onCancel} on:show={onShow}>
<ModalContent
title={"Update app"}
@ -104,7 +104,7 @@
bind:value={$values.name}
error={$touched.name && $errors.name}
on:blur={() => ($touched.name = true)}
on:change={() => dirty = true}
on:change={() => (dirty = true)}
label="Name"
/>
</ModalContent>

View file

@ -297,11 +297,7 @@
Are you sure you want to unpublish the app <b>{selectedApp?.name}</b>?
</ConfirmDialog>
<UpdateAppModal
app={selectedApp}
bind:this={updatingModal}
>
</UpdateAppModal>
<UpdateAppModal app={selectedApp} bind:this={updatingModal} />
<style>
.title,

View file

@ -1,7 +1,7 @@
import { writable } from "svelte/store"
import { get } from "builderStore/api"
import { AppStatus } from "../../constants"
import api from "../../builderStore/api";
import api from "../../builderStore/api"
export function createAppStore() {
const store = writable([])
@ -54,15 +54,17 @@ export function createAppStore() {
}
}
async function update (appId, name) {
async function update(appId, name) {
const response = await api.put(`/api/applications/${appId}`, { name })
if (response.status === 200) {
store.update(state => {
const updatedAppIndex = state.findIndex(app => app.instance._id === appId);
const updatedAppIndex = state.findIndex(
app => app.instance._id === appId
)
if (updatedAppIndex !== -1) {
const updatedApp = state[updatedAppIndex];
updatedApp.name = name;
state.apps = state.splice(updatedAppIndex, 1, updatedApp);
const updatedApp = state[updatedAppIndex]
updatedApp.name = name
state.apps = state.splice(updatedAppIndex, 1, updatedApp)
}
return state
})