fix create application

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-06 13:28:30 +02:00
parent d034094829
commit e9f12766c1
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0

View File

@ -38,11 +38,14 @@
const client = getClient()
async function createCandidate() {
const state = client.findOne(core.class.State, { space })
async function createApplication() {
const state = await client.findOne(core.class.State, { space })
if (state === undefined) {
throw new Error('create application: state not found')
}
await client.createDoc(recruit.class.Applicant, space, {
candidate,
state
state: state._id
})
dispatch('close')
}
@ -51,7 +54,7 @@
<Card label={'Create Application'}
okLabel={'Save'}
okAction={createCandidate}
okAction={createApplication}
on:close={() => { dispatch('close') }}>
<Grid column={1} rowGap={1.75}>
<UserBox _class={recruit.class.Candidate} title='Candidate' caption='Candidates' bind:value={candidate} />