javascript - Promise failing because of 'Cannot read property 'then' of undefined.' -
i getting error.
cannot read property 'then' of undefined.
i hope rest of code should, somehow promise not work. doing wrong?
// @flow import { commitmutation, graphql } 'react-relay'; const mutation = graphql` mutation copyarticlemutation($input: copyarticleinput!) { copyarticle(input: $input) { article{ rowid } } } `; export default (baseid: string, environment: any) => { new promise((resolve, reject) => { commitmutation(environment, { mutation, variables: { input: { baseid, }, }, oncompleted: resolve, onerror: reject, }); }); };
i use so:
createarticlefromtemplate = (templatearticle: object) => { if (!templatearticle.istemplate) { return null; } if (templatearticle.id !== 'undefined' && templatearticle) { copyarticlemutation(templatearticle.id, this.props.relay.environment).then(({ copyarticle }) => { console.log(copyarticle); }); } };
i sure trivial error. appreciated anyway.
Comments
Post a Comment