mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-23 04:36:52 +00:00
cases
This commit is contained in:
@@ -68,19 +68,18 @@ export const saveTempPublish = async ({ data, key }: any) => {
|
||||
|
||||
export const getTempPublish = async () => {
|
||||
return new Promise((res, rej) => {
|
||||
chrome?.runtime?.sendMessage(
|
||||
{
|
||||
action: "getTempPublish",
|
||||
payload: {},
|
||||
},
|
||||
(response) => {
|
||||
if (!response?.error) {
|
||||
res(response);
|
||||
return;
|
||||
}
|
||||
rej(response.error);
|
||||
}
|
||||
);
|
||||
window.sendMessage("getTempPublish", {})
|
||||
.then((response) => {
|
||||
if (!response?.error) {
|
||||
res(response);
|
||||
return;
|
||||
}
|
||||
rej(response.error);
|
||||
})
|
||||
.catch((error) => {
|
||||
rej(error.message || "An error occurred");
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -103,40 +103,40 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
||||
})
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
chrome?.runtime?.sendMessage(
|
||||
{
|
||||
action: "createGroup",
|
||||
payload: {
|
||||
groupName: name,
|
||||
groupDescription: description,
|
||||
groupType: +groupType,
|
||||
groupApprovalThreshold: +approvalThreshold,
|
||||
minBlock: +minBlock,
|
||||
maxBlock: +maxBlock,
|
||||
},
|
||||
},
|
||||
(response) => {
|
||||
|
||||
if (!response?.error) {
|
||||
setInfoSnack({
|
||||
type: "success",
|
||||
message: "Successfully created group. It may take a couple of minutes for the changes to propagate",
|
||||
});
|
||||
setOpenSnack(true);
|
||||
setTxList((prev)=> [{
|
||||
window.sendMessage("createGroup", {
|
||||
groupName: name,
|
||||
groupDescription: description,
|
||||
groupType: +groupType,
|
||||
groupApprovalThreshold: +approvalThreshold,
|
||||
minBlock: +minBlock,
|
||||
maxBlock: +maxBlock,
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response?.error) {
|
||||
setInfoSnack({
|
||||
type: "success",
|
||||
message: "Successfully created group. It may take a couple of minutes for the changes to propagate",
|
||||
});
|
||||
setOpenSnack(true);
|
||||
setTxList((prev) => [
|
||||
{
|
||||
...response,
|
||||
type: 'created-group',
|
||||
label: `Created group ${name}: awaiting confirmation`,
|
||||
labelDone: `Created group ${name}: success !`,
|
||||
done: false
|
||||
}, ...prev])
|
||||
res(response);
|
||||
return
|
||||
}
|
||||
rej({message: response.error});
|
||||
|
||||
labelDone: `Created group ${name}: success!`,
|
||||
done: false,
|
||||
},
|
||||
...prev,
|
||||
]);
|
||||
res(response);
|
||||
return;
|
||||
}
|
||||
);
|
||||
rej({ message: response.error });
|
||||
})
|
||||
.catch((error) => {
|
||||
rej({ message: error.message || "An error occurred" });
|
||||
});
|
||||
|
||||
});
|
||||
} catch (error) {
|
||||
setInfoSnack({
|
||||
|
@@ -75,11 +75,11 @@ export const ListOfInvites = ({ groupId, setInfoSnack, setOpenSnack, show }) =>
|
||||
})
|
||||
setIsLoadingCancelInvite(true)
|
||||
await new Promise((res, rej)=> {
|
||||
chrome?.runtime?.sendMessage({ action: "cancelInvitationToGroup", payload: {
|
||||
groupId,
|
||||
qortalAddress: address,
|
||||
}}, (response) => {
|
||||
|
||||
window.sendMessage("cancelInvitationToGroup", {
|
||||
groupId,
|
||||
qortalAddress: address,
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response?.error) {
|
||||
setInfoSnack({
|
||||
type: "success",
|
||||
@@ -87,17 +87,26 @@ export const ListOfInvites = ({ groupId, setInfoSnack, setOpenSnack, show }) =>
|
||||
});
|
||||
setOpenSnack(true);
|
||||
handlePopoverClose();
|
||||
setIsLoadingCancelInvite(true)
|
||||
res(response)
|
||||
return
|
||||
setIsLoadingCancelInvite(true);
|
||||
res(response);
|
||||
return;
|
||||
}
|
||||
setInfoSnack({
|
||||
type: "error",
|
||||
message: response?.error,
|
||||
});
|
||||
setOpenSnack(true);
|
||||
rej(response.error)
|
||||
rej(response.error);
|
||||
})
|
||||
.catch((error) => {
|
||||
setInfoSnack({
|
||||
type: "error",
|
||||
message: error.message || "An error occurred",
|
||||
});
|
||||
setOpenSnack(true);
|
||||
rej(error);
|
||||
});
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
|
@@ -77,36 +77,36 @@ export const ManageMembers = ({
|
||||
})
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
chrome?.runtime?.sendMessage(
|
||||
{
|
||||
action: "leaveGroup",
|
||||
payload: {
|
||||
groupId: selectedGroup?.groupId,
|
||||
},
|
||||
},
|
||||
(response) => {
|
||||
|
||||
window.sendMessage("leaveGroup", {
|
||||
groupId: selectedGroup?.groupId,
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response?.error) {
|
||||
setTxList((prev)=> [{
|
||||
...response,
|
||||
type: 'leave-group',
|
||||
label: `Left Group ${selectedGroup?.groupName}: awaiting confirmation`,
|
||||
labelDone: `Left Group ${selectedGroup?.groupName}: success !`,
|
||||
done: false,
|
||||
groupId: selectedGroup?.groupId,
|
||||
|
||||
}, ...prev])
|
||||
setTxList((prev) => [
|
||||
{
|
||||
...response,
|
||||
type: 'leave-group',
|
||||
label: `Left Group ${selectedGroup?.groupName}: awaiting confirmation`,
|
||||
labelDone: `Left Group ${selectedGroup?.groupName}: success!`,
|
||||
done: false,
|
||||
groupId: selectedGroup?.groupId,
|
||||
},
|
||||
...prev,
|
||||
]);
|
||||
res(response);
|
||||
setInfoSnack({
|
||||
type: "success",
|
||||
message: "Successfully requested to leave group. It may take a couple of minutes for the changes to propagate",
|
||||
});
|
||||
setOpenSnack(true);
|
||||
return
|
||||
return;
|
||||
}
|
||||
rej(response.error);
|
||||
}
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
rej(error.message || "An error occurred");
|
||||
});
|
||||
|
||||
});
|
||||
} catch (error) {} finally {
|
||||
setIsLoadingLeave(false)
|
||||
|
Reference in New Issue
Block a user