Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
#4 | Added initialWorkingDirectory to config
Browse files Browse the repository at this point in the history
  • Loading branch information
LeanderFS committed Jan 10, 2019
1 parent 48676be commit 696008e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ const setCwd = async (dispatch, pid) => {
});
}

let config;
exports.middleware = (store) => (next) => async (action) => {
switch (action.type) {
case 'CONFIG_RELOAD':
case 'CONFIG_LOAD':
config = action.config.hyperwd || {};
case 'SESSION_REQUEST':
case 'TERM_GROUP_REQUEST': {
const { activeUid, sessions } = store.getState().sessions;
Expand All @@ -19,10 +23,18 @@ exports.middleware = (store) => (next) => async (action) => {
}
break;
}
case 'INIT':
if (config.initialWorkingDirectory) {
store.dispatch({
type: 'SESSION_SET_CWD',
cwd: config.initialWorkingDirectory,
});
}
default:
break;
}

next(action);
};


0 comments on commit 696008e

Please sign in to comment.