reports.js 430 B

1234567891011121314151617
  1. import Toast from "toasters";
  2. import io from "../../io";
  3. export default {
  4. resolve(reportId) {
  5. return new Promise((resolve, reject) => {
  6. io.getSocket(socket => {
  7. socket.emit("reports.resolve", reportId, res => {
  8. new Toast({ content: res.message, timeout: 3000 });
  9. if (res.status === "success")
  10. return resolve({ status: "success" });
  11. return reject(new Error(res.message));
  12. });
  13. });
  14. });
  15. }
  16. };