Σ(゚Д゚;≡;゚д゚)Σ(゚Д゚;≡;゚д゚)Σ(゚Д゚;≡;゚д゚)始,故人唐宰相鲁公,🆚开府南服,余以布衣从戎。明年,别公漳水湄。后明年,公以事过张睢阳庙及颜杲卿所尝往来处,悲歌慷慨,卒不负其言而从之游。今其诗具在,可考也。😭
// External dependencies.
import {
state,
} from 'cerebral';
import { noop } from 'lodash';
// Internal dependencies.
import { saveToCloudPure } from '@cloud/app/lib/api';
const saveToCloud = ({ get, props, path }) => {
const itemId = get(state`edit.item.id`);
const context = get(state`context`);
let snippetContent = get(state`edit.content`);
snippetContent = {
...snippetContent,
data: props.content,
};
return saveToCloudPure(context, { content: JSON.stringify(snippetContent) }, [], noop, itemId)
.then(() => path.success())
.catch(() => path.error());
};
const saveToLocal = ({ codeSnippetsLibApi, path, props: { content }, get }) => {
const itemId = get(state`edit.item.id`);
return codeSnippetsLibApi.saveItemContent(itemId, content)
.then(response => path.success({ snippet: response.snippet }))
.catch(() => path.error());
};
export {
saveToCloud,
saveToLocal,
};