update unlist when delete
This commit is contained in:
parent
84111c08f8
commit
0fbe29af54
|
|
@ -62,6 +62,16 @@ export default function List() {
|
||||||
const { user } = useAppSelector((state: RootState) => state.app);
|
const { user } = useAppSelector((state: RootState) => state.app);
|
||||||
|
|
||||||
const handleDelete = async (data: IProduct) => {
|
const handleDelete = async (data: IProduct) => {
|
||||||
|
if (data.status) {
|
||||||
|
const response = await productApi.customAction(
|
||||||
|
data.id || 0,
|
||||||
|
"unlist",
|
||||||
|
data
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!response || !response?.data) return;
|
||||||
|
}
|
||||||
|
|
||||||
const result = await productApi.delete(data);
|
const result = await productApi.delete(data);
|
||||||
|
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
|
|
@ -395,11 +405,6 @@ export default function List() {
|
||||||
</ProductModal>
|
</ProductModal>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
options={{
|
|
||||||
disableDel(data) {
|
|
||||||
return data.id === user?.id;
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue