changed swal to swal2 in ModLoadSave

This commit is contained in:
knoxfighter 2018-08-11 02:26:28 +02:00
parent b679415860
commit 88cf32da73

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import ReactDOMServer from 'react-dom/server';
import {instanceOfModsContent} from "./ModsPropTypes"; import {instanceOfModsContent} from "./ModsPropTypes";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import {ReactSwalNormal, ReactSwalDanger} from './../../../js/customSwal';
class ModLoadSave extends React.Component { class ModLoadSave extends React.Component {
constructor(props) { constructor(props) {
@ -46,7 +46,7 @@ class ModLoadSave extends React.Component {
}); });
if(checkboxes.length == 0) { if(checkboxes.length == 0) {
swal({ ReactSwalNormal.fire({
title: "No mods in this save!", title: "No mods in this save!",
type: "error" type: "error"
}); });
@ -76,20 +76,19 @@ class ModLoadSave extends React.Component {
</div> </div>
</div> </div>
swal({ ReactSwalDanger.fire({
title: "Mods to install", title: "Mods to install",
text: ReactDOMServer.renderToStaticMarkup(table), html: table,
html: true, type: 'question',
type: 'info',
showCancelButton: true, showCancelButton: true,
closeOnConfirm: false, closeOnConfirm: false,
confirmButtonText: "Download Mods!", confirmButtonText: "Download Mods!",
cancelButtonText: "Cancel", showLoaderOnConfirm: true,
showLoaderOnConfirm: true preConfirm: this.loadModsSwalHandler
}, this.loadModsSwalHandler); });
}, },
error: (jqXHR) => { error: (jqXHR) => {
swal({ ReactSwalNormal.fire({
title: jqXHR.responseJSON.data, title: jqXHR.responseJSON.data,
html: true, html: true,
type: "error", type: "error",
@ -105,7 +104,7 @@ class ModLoadSave extends React.Component {
dataType: "JSON", dataType: "JSON",
data: $("#swalForm").serialize(), data: $("#swalForm").serialize(),
success: (data) => { success: (data) => {
swal({ ReactSwalNormal.fire({
title: "All Mods installed successfully!", title: "All Mods installed successfully!",
type: "success" type: "success"
}); });
@ -117,7 +116,7 @@ class ModLoadSave extends React.Component {
error: (jqXHR) => { error: (jqXHR) => {
let json_data = JSON.parse(jqXHR.responseJSON.data); let json_data = JSON.parse(jqXHR.responseJSON.data);
swal({ ReactSwalNormal.fire({
title: json_data.detail, title: json_data.detail,
type: "error", type: "error",
}); });