Skip to content

Commit

Permalink
eslint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Sep 8, 2017
1 parent 015f414 commit 69e0b8c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/client/actions/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function updateGroup(groupName, type, value, method) {
type: UPDATE_GROUP,
meta: groupName,
payload: apiFetchJSON(url, {method}).then(() => apiFetchJSON(groupUrl))
}
};
}

export const CREATE_GROUP = 'CREATE_GROUP';
Expand Down Expand Up @@ -105,7 +105,7 @@ async function doLdapSync(groupName) {
const groupUrl = `db/${dbManager.currentDb}/group/${groupName}`;
const syncUrl = `${groupUrl}/ldap/sync`;
let res = await apiFetchJSON(syncUrl);
if(!res.error) {
if (!res.error) {
res = await apiFetchJSON(groupUrl);
}
return res;
Expand Down
6 changes: 3 additions & 3 deletions src/client/components/Ephemere.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ class Ephemere extends Component {
}

componentWillUpdate() {
if(this.refs.ephemere) {
if (this.refs.ephemere) {
this.refs.ephemere.style.display = 'block';
}
if(this.timeout) {
if (this.timeout) {
clearTimeout(this.timeout);
}
}

componentDidUpdate() {
this.timeout = setTimeout(() => {
this.refs.ephemere.style.display = 'none';
}, this.props.timeout || 3000)
}, this.props.timeout || 3000);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/client/reducers/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ const dbReducer = (state = initialState, action) => {
}
case `${UPDATE_GROUP}_FULFILLED`: {
const index = state.userGroups.findIndex(group => group.name === action.meta);
if(index === -1) {
if (index === -1) {
throw new Error('should not happen');
}
const newGroupList = state.userGroups.slice();
if(action.payload.error) {
if (action.payload.error) {
newGroupList[index] = Object.assign({}, newGroupList[index], {error: action.payload.error, success: null});
return Object.assign({}, state, {
userGroups: newGroupList
});
} else {
if(action.payload.name !== action.meta) {
throw new Error('should not happen')
if (action.payload.name !== action.meta) {
throw new Error('should not happen');
}
newGroupList[index] = action.payload;
newGroupList[index].success = 'Group sucessfully updated';
Expand Down
18 changes: 9 additions & 9 deletions src/util/LDAP.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ function search(ldapOptions, searchOptions) {
// if client could know when it is ready
// promises would be much easier to handle :-(
const client = ldapjs.createClient(ldapOptions);
client.on('error', function(e) {
client.on('error', function (e) {
reject(e);
});

client.__resolve__ = function(value) {
client.__resolve__ = function (value) {
client.destroy();
resolve(value);
};

client.__reject__ = function(err) {
client.__reject__ = function (err) {
client.destroy();
reject(err);
};
Expand All @@ -52,23 +52,23 @@ function search(ldapOptions, searchOptions) {
client.__resolve__(entries);
});
});
} catch(e) {
} catch (e) {
// LIBRARY!!! WHY DON'T YOU PASS ALL YOUR ERRORS IN THE CALLBACK!!!
client.__reject__(e);
}

}).catch(e => {/* Error should be handled by __reject__ */});
}).catch(() => {/* Error should be handled by __reject__ */});
});
}

function bind(client, DN, password) {
if(!DN || !password) {
debug(`ldap search: bypass authentication`);
if (!DN || !password) {
debug('ldap search: bypass authentication');
return Promise.resolve();
}
return new Promise((resolve, reject) => {
client.bindDN(DN, password, function(err) {
if(err) {
client.bindDN(DN, password, function (err) {
if (err) {
client.__reject__(err);
reject(err);
return;
Expand Down

0 comments on commit 69e0b8c

Please sign in to comment.