reports.ts 709 B

123456789101112131415161718192021222324252627
  1. /* eslint-disable import/no-cycle */
  2. import Toast from "toasters";
  3. import ws from "@/ws";
  4. export default {
  5. resolve({ reportId, value }) {
  6. return new Promise((resolve, reject) => {
  7. ws.socket.dispatch("reports.resolve", reportId, value, res => {
  8. new Toast(res.message);
  9. if (res.status === "success")
  10. return resolve({ status: "success" });
  11. return reject(new Error(res.message));
  12. });
  13. });
  14. },
  15. remove(reportId) {
  16. return new Promise((resolve, reject) => {
  17. ws.socket.dispatch("reports.remove", reportId, res => {
  18. new Toast(res.message);
  19. if (res.status === "success")
  20. return resolve({ status: "success" });
  21. return reject(new Error(res.message));
  22. });
  23. });
  24. }
  25. };