|
|
@ -6,6 +6,27 @@ |
|
|
export let onOkay = () => {} |
|
|
export let onOkay = () => {} |
|
|
|
|
|
|
|
|
const { close } = getContext("simple-modal") |
|
|
const { close } = getContext("simple-modal") |
|
|
|
|
|
|
|
|
|
|
|
let name = "" |
|
|
|
|
|
let description = "" |
|
|
|
|
|
|
|
|
|
|
|
const createNewApp = async () => { |
|
|
|
|
|
const data = { name, description} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
const response = await fetch('/api/applications', { |
|
|
|
|
|
method: 'POST', // *GET, POST, PUT, DELETE, etc. |
|
|
|
|
|
credentials: 'same-origin', // include, *same-origin, omit |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/json' |
|
|
|
|
|
// 'Content-Type': 'application/x-www-form-urlencoded', |
|
|
|
|
|
}, |
|
|
|
|
|
body: JSON.stringify(data) // body data type must match "Content-Type" header |
|
|
|
|
|
}); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let value |
|
|
let value |
|
|
let onChange = () => {} |
|
|
let onChange = () => {} |
|
|
@ -15,12 +36,10 @@ |
|
|
close() |
|
|
close() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function _onOkay() { |
|
|
async function _onOkay() { |
|
|
onOkay(value) |
|
|
await createNewApp() |
|
|
close() |
|
|
close() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$: onChange(value) |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
@ -29,8 +48,9 @@ |
|
|
<span class="icon"><AppsIcon /></span> |
|
|
<span class="icon"><AppsIcon /></span> |
|
|
<h3>Create new web app</h3> |
|
|
<h3>Create new web app</h3> |
|
|
</div> |
|
|
</div> |
|
|
<Input name="name" label="Name" placeholder="Enter application name" /> |
|
|
<Input name="name" label="Name" placeholder="Enter application name" on:change={(e) => name = e.target.value} on:input={(e) => name = e.target.value} /> |
|
|
<TextArea |
|
|
<TextArea |
|
|
|
|
|
bind:value={description} |
|
|
name="description" |
|
|
name="description" |
|
|
label="Description" |
|
|
label="Description" |
|
|
placeholder="Describe your application" /> |
|
|
placeholder="Describe your application" /> |
|
|
|