add: withdraw profit
This commit is contained in:
parent
6aba46aca3
commit
853c849523
|
@ -76,6 +76,22 @@ export const DetailUser = observer(() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const withdrawProfit = async (id) => {
|
||||||
|
try {
|
||||||
|
modalLoader.setLoading(true);
|
||||||
|
const response = await store.membership.withdrawProfit(id);
|
||||||
|
modalLoader.setLoading(false);
|
||||||
|
|
||||||
|
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||||
|
? message.success(`Success Withdraw Profit`)
|
||||||
|
: message.error(`Failed Withdraw Profit`);
|
||||||
|
await getData();
|
||||||
|
} catch (err) {
|
||||||
|
modalLoader.setLoading(false);
|
||||||
|
message.error(`Failed Withdraw Profit`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
data.superior = true;
|
data.superior = true;
|
||||||
setConfirmLoading(true);
|
setConfirmLoading(true);
|
||||||
|
@ -312,9 +328,8 @@ export const DetailUser = observer(() => {
|
||||||
: "primary"
|
: "primary"
|
||||||
}
|
}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
changeStatus(
|
withdrawProfit(
|
||||||
store.membership.dataDetail.id,
|
store.membership.dataDetail.id,
|
||||||
store.membership.dataDetail.isActive
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -119,6 +119,16 @@ export class Membership {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async withdrawProfit(id) {
|
||||||
|
try {
|
||||||
|
const response = await http.put(`/transaction/withdraw/${id}`);
|
||||||
|
await this.getData();
|
||||||
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user