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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -