Migrate changes from other Metamigo repo
This commit is contained in:
parent
8669b09224
commit
27810142b3
11 changed files with 615 additions and 235 deletions
|
|
@ -123,14 +123,6 @@ const WhatsappBotShow = (props: ShowProps) => {
|
|||
resource: "whatsappBots",
|
||||
payload: { id: props.id },
|
||||
});
|
||||
const [unverify] = useMutation({
|
||||
type: "update",
|
||||
resource: "whatsappBots",
|
||||
payload: {
|
||||
id: props.id,
|
||||
data: { isVerified: false, qrCode: null, authInfo: null },
|
||||
},
|
||||
});
|
||||
|
||||
const { data: registerData, error: registerError } = useSWR(
|
||||
data && !data?.isVerified
|
||||
|
|
@ -139,6 +131,16 @@ const WhatsappBotShow = (props: ShowProps) => {
|
|||
{ refreshInterval: 59000 }
|
||||
);
|
||||
|
||||
const unverifyBot = async () => {
|
||||
await fetch(`/api/v1/whatsapp/bots/${props.id}/unverify`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ verified: false }),
|
||||
});
|
||||
};
|
||||
|
||||
console.log({ registerData, registerError });
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -160,7 +162,7 @@ const WhatsappBotShow = (props: ShowProps) => {
|
|||
color="primary"
|
||||
size="small"
|
||||
style={{ color: "black", backgroundColor: "#ddd" }}
|
||||
onClick={unverify}
|
||||
onClick={async () => unverifyBot()}
|
||||
>
|
||||
Unverify
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue