【发布时间】:2021-08-10 00:26:50
【问题描述】:
所以我有这个应用程序,我点击一个按钮,它会开始一系列模式来接受用户输入。尝试使用新视图对象更新当前模式时遇到问题。
在响应模式中的其他按钮时,我可以更新和推送新视图,但在提交按钮时则不行。不幸的是,在使用输入块时,您必须包含一个提交按钮。
这是我用来处理单击提交时收到的 view_submission 有效负载的代码。
app.view('callback_period', async ({ ack, body, view, client }) => { // Pass callback_id
// Acknowledge the view_submission event
await ack();
// Log out view ID to confirm it is indeed the same as the initial view
try {
console.log(body.view.id);
const result = await client.views.update({
response_action: "update",
view_id: body.view.id,
hash: body.view.hash,
view: views_payroll_prefill_shift
});
console.log(result);
console.log(body.view.id);
}
catch (error) {
console.error(error);
console.log(body.view.id);
}
});
因此,当我单击按钮时,我的应用程序可以正常接收有效负载,但 client.views.update 方法只会给我一个“not_found”错误。我检查了文档,它说 view_id 一定是无效的,但是我已经从原始模式中记录了视图 ID,并且它始终是一致的。我不明白为什么它适用于 app.actions() 而不是 app.view()。
我已尝试为原始 body.view.id 创建 const 并传递它,但我会不断从 app.views() 收到此 not_found 错误。
我真的是束手无策。任何帮助将不胜感激。
【问题讨论】:
标签: javascript node.js slack slack-api