小编Sun*_*y G的帖子

如何在 angular 中使用 import { onError } from 'apollo-link-error' 来处理所有错误

下面是我的apollo angular设置代码:

providers: [
    {
      provide: APOLLO_OPTIONS,
      useFactory: (httpLink: HttpLink) => {
        return {
          cache: new InMemoryCache(),
          link: httpLink.create({
            uri: AppSettings.API_ENDPOINT

          })
        }
      },
      deps: [HttpLink]
    }
  ],
Run Code Online (Sandbox Code Playgroud)

我想在下面使用:

const link = onError(({ graphQLErrors, networkError }) => {
  if (graphQLErrors)
    graphQLErrors.map(({ message, locations, path }) =>
      console.log(
        `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`,
      ),
    );

  if (networkError) console.log(`[Network error]: ${networkError}`);
});
Run Code Online (Sandbox Code Playgroud)

如何链接它以便我能够在控制台中收到错误?

graphql angular apollo-angular

5
推荐指数
2
解决办法
3762
查看次数

slack获取从conversation.history api返回的消息的消息发件人名称

我正在调用 slack API(conversations.history) 来获取频道消息。我想在消息响应中检索发件人姓名。我怎么才能得到它?

以下是我的留言回复:

{  "client_msg_id": "0e19ca7d-1072-4f73-a932-9ec7fa9956de",
          "type": "message",
          "text": "Yeah good edge case, I would agree, just mentioning \" no data found\"",
          "user": "U01JW9D10PQ",
          "ts": "1642216920.001100",
          "team": "T01K38V9Q7M", blocks:[]}
Run Code Online (Sandbox Code Playgroud)

node.js slack-api

4
推荐指数
1
解决办法
512
查看次数

标签 统计

angular ×1

apollo-angular ×1

graphql ×1

node.js ×1

slack-api ×1