Commit dd39dc33 authored by Renato Becker's avatar Renato Becker Committed by Tasso Evangelista

[FIX] setDepartment method wasn't supporting the department name as parameter (#177)

parent 30a76106
No preview for this file type
......@@ -59,21 +59,17 @@ const api = {
});
},
setDepartment(departmentValue) {
let department = null;
setDepartment(value) {
const { config: { departments = [] } } = store.state;
const deptExists = departments.some((dept) => dept._id === departmentValue);
if (deptExists) {
department = departmentValue;
}
const dept = departments.find((dep) => dep._id === value || dep.name === value);
const department = (dept && dept._id) || '';
updateIframeGuestData({ department });
},
clearDepartment() {
const { iframe: { guest, ...iframe } } = store.state;
store.setState({ iframe: { ...iframe, guest: { ...guest, department: null } } });
updateIframeGuestData({ department: '' });
},
setExpanded(expanded) {
......
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