Sha256: ce9d0415ee144d4eae046c9df24cea6273294e40fa12a2f1af6911986febfa68
Contents?: true
Size: 756 Bytes
Versions: 35
Compression:
Stored size: 756 Bytes
Contents
const ModelDestroyButton = ({ label, modelName, modelUrl, modelsUrl }) => { const openModal = () => { ShopifyApp.Modal.confirm({ title: 'Delete ' + modelName + '?', message: 'Are you sure you want to delete this ' + modelName + '?', okButton: 'Delete ' + modelName, cancelButton: 'Cancel', style: 'danger' }, handleModalResult); }; const handleModalResult = (result) => { if(result) { $.ajax({ url: modelUrl, method: 'DELETE', contentType: 'application/json', dataType: 'json', success: function() { window.location.href = modelsUrl; } }); } }; return ( <Button destroy={true} onClick={openModal}>{label}</Button> ); };
Version data entries
35 entries across 35 versions & 1 rubygems