mirror of https://github.com/embarklabs/embark.git
Add back event on file save sucess
This commit is contained in:
parent
a9bf409aa0
commit
436786bfe4
|
@ -289,7 +289,7 @@ export const file = {
|
|||
export const SAVE_FILE = createRequestTypes('SAVE_FILE');
|
||||
export const saveFile = {
|
||||
request: ({name, path, content}) => action(SAVE_FILE[REQUEST], {name, path, content}),
|
||||
success: (_, {name, path, content}) => action(SAVE_FILE[SUCCESS], {name, path, content}),
|
||||
success: (file) => action(SAVE_FILE[SUCCESS], {file}),
|
||||
failure: (error) => action(SAVE_FILE[FAILURE], {error})
|
||||
};
|
||||
|
||||
|
|
|
@ -208,6 +208,10 @@ export function *watchPostFile() {
|
|||
yield takeEvery(actions.SAVE_FILE[actions.REQUEST], postFile);
|
||||
}
|
||||
|
||||
export function *watchPostFileSuccess() {
|
||||
yield takeEvery(actions.SAVE_FILE[actions.SUCCESS], addEditorTabs);
|
||||
}
|
||||
|
||||
export function *watchDeleteFile() {
|
||||
yield takeEvery(actions.REMOVE_FILE[actions.REQUEST], deleteFile);
|
||||
}
|
||||
|
@ -539,5 +543,6 @@ export default function *root() {
|
|||
fork(watchRemoveEditorTabs),
|
||||
fork(watchAddEditorTabsSuccess),
|
||||
fork(watchRemoveEditorTabsSuccess),
|
||||
fork(watchPostFileSuccess)
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ export function addEditorTabs({file}) {
|
|||
editorTabs.forEach(f => f.active = false);
|
||||
const alreadyAddedFile = editorTabs.find(f => f.name === file.name)
|
||||
if (alreadyAddedFile) {
|
||||
alreadyAddedFile.active = true
|
||||
alreadyAddedFile.active = true;
|
||||
alreadyAddedFile.content = file.content;
|
||||
} else {
|
||||
file.active = true
|
||||
file.active = true;
|
||||
editorTabs.push(file);
|
||||
}
|
||||
localStorage.setItem('editorTabs', JSON.stringify(editorTabs));
|
||||
|
|
Loading…
Reference in New Issue