Promise.resolve没有正确返回?

时间:2017-08-31 19:09:28

标签: javascript

我有这个异步代码:

const getResult = async () => {
          const getAfterCursorQueryText = `
            query($count: Int!, $cursor:String) {# filename+Query
              viewer {
                publicTodos (first: $count, after: $cursor) {
                  edges {
                    cursor
                    node {
                      id
                    }
                  }     

               pageInfo { # for pagination
                hasPreviousPage
                startCursor 
                hasNextPage
                endCursor 
              }         
                }
              }
            }`;
          let cursor = fragmentVariables.cursor;
          let count = 5;
          const getAfterCursorQuery = { text: getAfterCursorQueryText };
          const result = await this.props.relay.environment._network.fetch(getAfterCursorQuery, {cursor, count});
          return Promise.resolve(result)
        }
        pageCursor = getResult().then( result => {
          return result.data.viewer.publicTodos.pageInfo.endCursor;
        })

但pageCursor具有承诺的价值:

  

无极    proto :承诺[[PromiseStatus]]:"已解决" [[PromiseValue]]:" YXJyYXljb25uZWN0aW9uOjQ ="

如何返回值?

0 个答案:

没有答案