[英]Apollo resolvers - await result from another resolver
I have a question.我有个问题。 I am using apollo -GraphQL and i have issue which i cant seem to solver correctly.
我正在使用 apollo -GraphQL,但我遇到了似乎无法正确求解的问题。 So i have type lie this:
所以我有类型谎言:
Price {
PriceBefore {
value
}
PriceAfter {
value
}
PriceSave {
value
}
}
And i index.ts i have:我 index.ts 我有:
PriceBefore: async (data: SomeData, source: any, { dataSources }: any, context: any) => {
return someCalculation:
}
PriceAfter : async (data: SomeData, source: any, { dataSources }: any, context: any) => {
return someCalculation:
}
PriceSave : async (data: SomeData, source: any, { dataSources }: any, context: any) => {
return someCalculation:
}
My problem is that i don't know how to wait with PriceAfter to PriceBefore is finished and how could i transfer result from PriceBefore to PriceAfter.我的问题是我不知道如何等待 PriceAfter 到 PriceBefore 完成,以及如何将结果从 PriceBefore 转移到 PriceAfter。 Same thin with PriceSave who should wait for PriceBefore and Price After to end and get data from them.
与 PriceSave 一样瘦,他们应该等待 PriceBefore 和 Price After 结束并从他们那里获取数据。
Is that possible does anybody knows?有人知道吗?
Thank in advance预先感谢
So in your case its not really doable.所以在你的情况下它不是真的可行。
You will have to split it into 2 calls and handle that from client.您必须将其拆分为 2 个调用并从客户端处理它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.