admin管理员组文章数量:1357620
I'm trying to update a state variable (message) after onStartingAcw event listener, but this not works (I don't have error menssages of the intent of update), I have a console.log on the handlerCallDestroyed and this works fine when the agent enters on ACW (after the call ends), but I can't update the value of message. This is a 3p App working on Amazon Connect Agent Workspace, I'm running my App on localhost:3000 (attached to Amazon Connect Agent Workspace) Am I doing somethis wrong? This is my code:
import { useState, useEffect } from "react";
import { AmazonConnectApp } from "@amazon-connect/app";
import { ContactClient, AgentClient, ContactStartingAcwEventData } from "@amazon-connect/contact";
import './App.css';
const provider = AmazonConnectApp.init({
onCreate: (event) => {
const { appInstanceId, appConfig } = event.context;
console.log('App initialized:', appInstanceId);
console.log("Permissions:", appConfig.permissions);
},
onDestroy: (event) => {
console.log('App being destroyed', event);
}
});
function App() {
const [message, setMessage] = useState("Esperando eventos...");
useEffect(() => {
const agentClient = new AgentClient();
const contactClient = new ContactClient();
const handlerCallDestroyed = (ContactStartingAcwEventData) => {
console.log("test", ContactStartingAcwEventData);
setMessage("Llamada finalizada - ACW completado");
};
contactClient.onStartingAcw(handlerCallDestroyed);
}, []);
return (
<div className="App">
<p className="message">Mensaje: {message}</p>
</div>
);
}
export default App;
本文标签: amazon web servicesCan39t update a state variable after onStartingAcw eventStack Overflow
版权声明:本文标题:amazon web services - Can't update a state variable after onStartingAcw event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744016561a2576436.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论