Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public confirmDeleteUser(user: User): void {
// Due to sweet alert scope issue, define as function variable and pass to swal
const parent = this;
// let getUsers = this.getUsers;
this.errorMessage = '';
swal({
title: 'Are you sure?',
text: 'Once delete, you won\'t be able to revert this!',
type: 'question',
showLoaderOnConfirm: true,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
preConfirm: function () {
parent.loading = true;
return new Promise(function (resolve, reject) {
parent.userDataService.deleteUserById(user.id)
.subscribe(
result => {
parent.getUsers();
parent.loading = false;
async createAccount() {
// Check for bip44 account gap (20 empty accounts)
const emptyAccounts =
Object.values(this.props.accounts)
.filter(account => account.internal && !account.transactions.length)
.sort((a, b) => b.accountIndex - a.accountIndex);
if(emptyAccounts.length >= 2 && (emptyAccounts[0].accountIndex - 20 >= emptyAccounts[emptyAccounts.length - 2].accountIndex)) {
return Swal({
title: this.translate({ id: 'accounts.create.tooMany' }),
type: 'error'
});
}
const { value: name } = await Swal({
title: this.translate({ id: 'accounts.create.title' }),
input: 'text',
inputPlaceholder: this.translate({ id: 'accounts.create.placeholder' }),
showCancelButton: true,
inputValidator: name => {
if(!name)
return this.translate({ id: 'accounts.create.requiresName' });
if(name.trim().length > 32)
return this.translate({ id: 'accounts.create.nameTooLong' })
const _processStoryOutput = (story) => {
try {
const {output} = story;
if ((output.data instanceof Blob) &&
(output.data.size > 0)) {
// output type is Blob,
// so download now
const blob = output.data;
swal({
title: 'Enter a filename',
input: 'text',
showCancelButton: true,
confirmButtonText: 'Save',
allowOutsideClick: false
}).then((filename) => {
FileSaver.saveAs(blob, filename);
})
.catch(() => {
// silent
FileSaver.saveAs(blob);
});
} else if ((typeof output.data !== 'undefined')
|| (!_.isEmpty(output.text))
|| (!_.isEmpty(output.data))) {
handleSubmit(event) {
event.preventDefault();
let cal_type = this.state.cal_type;
console.log(`handleSubmit - cal_type ${cal_type}`);
if (cal_type) {
if (cal_type != 'apple' || (this.state.ios_user && this.state.ios_pass)) {
this.props.syncCalendar(cal_type, this.state.ios_user, this.state.ios_pass);
}
} else {
swal('Validation error', 'Please complete all fields', 'warning');
}
}
onClick = async () => {
const { commonStore, contractsStore, ballotStore, ballotsStore } = this.props
const { push } = this.props.routing
if (!contractsStore.votingKey) {
swal('Warning!', messages.NO_METAMASK_MSG, 'warning')
return
} else if (!contractsStore.networkMatch) {
swal('Warning!', messages.networkMatchError(contractsStore.netId), 'warning')
return
} else if (!contractsStore.isValidVotingKey) {
swal('Warning!', messages.invalidVotingKeyMsg(contractsStore.votingKey), 'warning')
return
}
commonStore.showLoading()
const isFormValid = this.checkValidation()
if (isFormValid) {
if (ballotStore.ballotType === ballotStore.BallotType.keys) {
const inputToAreBallotParamsValid = {
export function warningOnFinalizeCrowdsale() {
return sweetAlert2({
title: "Finalize Crowdsale",
html: "Are you sure to finalize the crowdsale? After finalization, it's not possible to buy tokens, all tokens will be movable, reserved tokens will be issued. Press <strong>Yes</strong> to finalize, and <strong>NO</strong> to close this dialog.",
type: "warning",
showCancelButton: true,
cancelButtonText: "NO",
confirmButtonText: "Yes",
reverseButtons: true
})
}
export function notTheOwner() {
sweetAlert2({
title: "Not The Owner",
html: "Current user is not the owner of the Crowdsale, thus you won't be able to modify it",
type: "warning"
})
}
this.setState({
error
});
const config = {
type: 'success',
title: this.translate({ id: 'queue.transaction.sent' })
};
if (error) {
config.type = 'error';
config.title = this.translate({ id: 'queue.transaction.failed' });
config.text = error;
}
return Swal(config).then(res => {
this.setState({
loading: false
});
updateConfirmations();
});
}
alertImg() {
swal({
title: 'Sweet!',
text: 'Modal with a custom image.',
imageUrl: 'https://unsplash.it/400/200',
imageWidth: 400,
imageHeight: 200,
imageAlt: 'Custom image',
animation: false
});
}
}
.then((result)=> {
if (result.data.status === 'OK') {
swal({
title: 'Property updated!',
text: 'You are being redirected',
type: 'success',
showConfirmButton: false,
timer: 2500,
onOpen: () => {
swal.showLoading()
}
})
.then(()=> {
this.props.history.push("/back/admin/properties")
})
} else {
swal({
type: 'error',
title: 'Oops...',