diff --git a/plugins/recruit-resources/src/components/CreateApplication.svelte b/plugins/recruit-resources/src/components/CreateApplication.svelte index 4262b7cb5c..97cf365460 100644 --- a/plugins/recruit-resources/src/components/CreateApplication.svelte +++ b/plugins/recruit-resources/src/components/CreateApplication.svelte @@ -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 @@ { dispatch('close') }}>