Replace line endings on save
This commit is contained in:
parent
c40f7b4d5c
commit
e20bfe9d08
|
@ -293,7 +293,10 @@ export const setRulesSuccess = createAction('SET_RULES_SUCCESS');
|
||||||
export const setRules = rules => async (dispatch) => {
|
export const setRules = rules => async (dispatch) => {
|
||||||
dispatch(setRulesRequest());
|
dispatch(setRulesRequest());
|
||||||
try {
|
try {
|
||||||
await apiClient.setRules(rules);
|
const replacedLineEndings = rules
|
||||||
|
.replace(/^\n/g, '')
|
||||||
|
.replace(/\n\s*\n/g, '\n');
|
||||||
|
await apiClient.setRules(replacedLineEndings);
|
||||||
dispatch(addSuccessToast('Custom rules saved'));
|
dispatch(addSuccessToast('Custom rules saved'));
|
||||||
dispatch(setRulesSuccess());
|
dispatch(setRulesSuccess());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue