add preview support

This commit is contained in:
igoradamenko
2018-05-02 02:44:27 +03:00
parent b9c567c10e
commit 412fc7a97d
10 changed files with 107 additions and 41 deletions
+12 -1
View File
@@ -2,6 +2,8 @@ import { siteId, url } from './settings';
import fetcher from './fetcher'
// TODO: rename actions
/* common */
export const logOut = () => fetcher.get({ url: `/auth/logout`, overriddenApiBase: '' });
@@ -30,13 +32,21 @@ export const send = ({ text, pid }) => fetcher.post({
text,
locator: {
site: siteId,
url
url,
},
...(pid ? { pid } : {}),
},
withCredentials: true,
});
export const getPreview = ({ text }) => fetcher.post({
url: '/preview',
body: {
text,
},
withCredentials: true,
});
export const getUser = () => fetcher.get({
url: '/user',
withCredentials: true
@@ -83,6 +93,7 @@ export default {
vote,
send,
getUser,
getPreview,
pin,
unpin,