mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 12:49:32 +00:00
@@ -8,8 +8,7 @@ import {
|
|||||||
AutoIncrement,
|
AutoIncrement,
|
||||||
AllowNull,
|
AllowNull,
|
||||||
Unique,
|
Unique,
|
||||||
BelongsToMany,
|
BelongsToMany
|
||||||
HasMany
|
|
||||||
} from "sequelize-typescript";
|
} from "sequelize-typescript";
|
||||||
import User from "./User";
|
import User from "./User";
|
||||||
import UserQueue from "./UserQueue";
|
import UserQueue from "./UserQueue";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import rules from "../../accessRules";
|
import rules from "../../rules";
|
||||||
|
|
||||||
const check = (rules, role, action, data) => {
|
const check = (role, action, data) => {
|
||||||
const permissions = rules[role];
|
const permissions = rules[role];
|
||||||
if (!permissions) {
|
if (!permissions) {
|
||||||
// role is not present in the rules
|
// role is not present in the rules
|
||||||
@@ -29,7 +29,7 @@ const check = (rules, role, action, data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Can = ({ role, perform, data, yes, no }) =>
|
const Can = ({ role, perform, data, yes, no }) =>
|
||||||
check(rules, role, perform, data) ? yes() : no();
|
check(role, perform, data) ? yes() : no();
|
||||||
|
|
||||||
Can.defaultProps = {
|
Can.defaultProps = {
|
||||||
yes: () => null,
|
yes: () => null,
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import React, { useState } from "react";
|
|||||||
import { GithubPicker } from "react-color";
|
import { GithubPicker } from "react-color";
|
||||||
|
|
||||||
const ColorPicker = ({ onChange, currentColor, handleClose, open }) => {
|
const ColorPicker = ({ onChange, currentColor, handleClose, open }) => {
|
||||||
const [color, setColor] = useState(currentColor);
|
const [selectedColor, setSelectedColor] = useState(currentColor);
|
||||||
|
|
||||||
const handleChange = color => {
|
const handleChange = color => {
|
||||||
setColor(color.hex);
|
setSelectedColor(color.hex);
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ const ColorPicker = ({ onChange, currentColor, handleClose, open }) => {
|
|||||||
<GithubPicker
|
<GithubPicker
|
||||||
width={"100%"}
|
width={"100%"}
|
||||||
triangle="hide"
|
triangle="hide"
|
||||||
color={color}
|
color={selectedColor}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onChangeComplete={color => onChange(color.hex)}
|
onChangeComplete={color => onChange(color.hex)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
|
|||||||
</div>
|
</div>
|
||||||
<QueueSelect
|
<QueueSelect
|
||||||
selectedQueueIds={selectedQueueIds}
|
selectedQueueIds={selectedQueueIds}
|
||||||
onChange={values => setSelectedQueueIds(values)}
|
onChange={selectedIds => setSelectedQueueIds(selectedIds)}
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ const useAuth = () => {
|
|||||||
};
|
};
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
const handleLogin = async user => {
|
const handleLogin = async userData => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api.post("/auth/login", user);
|
const { data } = await api.post("/auth/login", userData);
|
||||||
localStorage.setItem("token", JSON.stringify(data.token));
|
localStorage.setItem("token", JSON.stringify(data.token));
|
||||||
api.defaults.headers.Authorization = `Bearer ${data.token}`;
|
api.defaults.headers.Authorization = `Bearer ${data.token}`;
|
||||||
setUser(data.user);
|
setUser(data.user);
|
||||||
|
|||||||
@@ -50,15 +50,13 @@ const MainListItems = () => {
|
|||||||
const delayDebounceFn = setTimeout(() => {
|
const delayDebounceFn = setTimeout(() => {
|
||||||
if (whatsApps.length > 0) {
|
if (whatsApps.length > 0) {
|
||||||
const offlineWhats = whatsApps.filter(whats => {
|
const offlineWhats = whatsApps.filter(whats => {
|
||||||
if (
|
return (
|
||||||
whats.status === "qrcode" ||
|
whats.status === "qrcode" ||
|
||||||
whats.status === "PAIRING" ||
|
whats.status === "PAIRING" ||
|
||||||
whats.status === "DISCONNECTED" ||
|
whats.status === "DISCONNECTED" ||
|
||||||
whats.status === "TIMEOUT" ||
|
whats.status === "TIMEOUT" ||
|
||||||
whats.status === "OPENING"
|
whats.status === "OPENING"
|
||||||
)
|
);
|
||||||
return true;
|
|
||||||
else return false;
|
|
||||||
});
|
});
|
||||||
if (offlineWhats.length > 0) {
|
if (offlineWhats.length > 0) {
|
||||||
setConnectionWarning(true);
|
setConnectionWarning(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user