enabled socket io in settings controller

This commit is contained in:
canove
2020-09-20 11:53:31 -03:00
parent 23d16679b6
commit 02c37276ba
3 changed files with 13 additions and 9 deletions

View File

@@ -1,10 +1,10 @@
import { Request, Response } from "express";
import { getIO } from "../libs/socket";
import AppError from "../errors/AppError";
import UpdateSettingService from "../services/SettingServices/UpdateSettingService";
import ListSettingsService from "../services/SettingServices/ListSettingsService";
// const { getIO } = require("../libs/socket");
export const index = async (req: Request, res: Response): Promise<Response> => {
if (req.user.profile !== "admin") {
@@ -31,11 +31,11 @@ export const update = async (
value
});
// const io = getIO();
// io.emit("settings", {
// action: "update",
// setting
// });
const io = getIO();
io.emit("settings", {
action: "update",
setting
});
return res.status(200).json(setting);
};