[Задача 12794] Добавил вывод сообщений пользователю с помощью библиотеки alertify.js.

parent 7d669ad3
......@@ -35,7 +35,7 @@ export default class Typo extends Component {
<CardBody>
<CardTitle><del>{typo.originalText}</del> -> {typo.correctedText}</CardTitle>
<CardText><div>{typo.context}</div></CardText>
<CardText>{typo.context}</CardText>
<div className="card-buttons">
<div className="buttons-wrapper">
......
import React, {Component} from 'react';
import Typo from "./Typo/index";
const alertify = require("alertify.js");
export default class TypoList extends Component {
state = {
currentTypo: 0,
......@@ -15,6 +17,8 @@ export default class TypoList extends Component {
*/
acceptCorrection(typoId) {
this._setTypoStatus(1, typoId, this.state.siteId, () => {
alertify.success(`<p>Опечатка ${typoId} была подтверждена.</p>
<p>Исправления применены к тексту, содержащему опечатку.</p>`);
this.state.currentTypo++;
this.forceUpdate();
});
......@@ -28,6 +32,7 @@ export default class TypoList extends Component {
*/
declineCorrection(typoId) {
this._setTypoStatus(0, typoId, this.state.siteId, () => {
alertify.success(`Опечатка ${typoId} была отклонена`);
this.state.currentTypo++;
this.forceUpdate();
});
......@@ -48,10 +53,9 @@ export default class TypoList extends Component {
$.ajax({
url: `${window.baseUrl}users/typos/setTypoStatus/${typoId}/${siteId}/${status}`,
}).done(() => {
alert("Status changed");
then();
}).fail((error) => {
alert("Status change error");
alertify.fail("Ошибка исправления опечатки, попробуйте позже");
console.error(error.message);
});
}
......
......@@ -5,6 +5,7 @@
"version": "0.0.1",
"private": true,
"dependencies": {
"alertify.js": "^1.0.12",
"bootstrap": "^4.0.0",
"free-jqgrid": "^4.15.3",
"jquery": "^3.3.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment