Little cleanup for admin services

This commit is contained in:
Chi Vinh Le
2017-05-25 19:22:59 +07:00
parent 93e6c0af32
commit 246ca117be
6 changed files with 7 additions and 41 deletions
-3
View File
@@ -1,3 +0,0 @@
{
"basePath": "admin"
}
@@ -1,9 +0,0 @@
import Pym from '../../node_modules/pym.js';
const pym = new Pym.Child({polling: 100});
export default pym;
export const link = (url) => (e) => {
e.preventDefault();
pym.sendMessage('navigate', url);
};
+5 -1
View File
@@ -4,13 +4,17 @@ import fragmentMatcher from './fragmentMatcher';
export const client = new ApolloClient({
fragmentMatcher,
connectToDevTools: true,
addTypename: true,
queryTransformer: addTypename,
dataIdFromObject: (result) => {
if (result.id && result.__typename) { // eslint-disable-line no-underscore-dangle
return result.__typename + result.id; // eslint-disable-line no-underscore-dangle
return `${result.__typename}_${result.id}`; // eslint-disable-line no-underscore-dangle
}
return null;
},
networkInterface
});
export default client;
-14
View File
@@ -1,14 +0,0 @@
/**
* Just load the root config file and throw an
* error message if not present
*/
try {
module.exports = require('../../config.json');
} catch (error) {
const message = `The config.json file under the root directory is missing
or invalid Please add one to use this app. You can use config.sample.json as a guide.`;
window.alert(message);
throw new Error(message);
}
@@ -1,14 +0,0 @@
import {print} from 'graphql-tag/printer';
// quick way to add the subscribe and unsubscribe functions to the network interface
const addGraphQLSubscriptions = (networkInterface, wsClient) => Object.assign(networkInterface, {
subscribe: (request, handler) => wsClient.subscribe({
query: print(request.query),
variables: request.variables,
}, handler),
unsubscribe: (id) => {
wsClient.unsubscribe(id);
},
});
export default addGraphQLSubscriptions;
@@ -13,6 +13,7 @@ import {networkInterface} from './transport';
// );
export const client = new ApolloClient({
connectToDevTools: true,
addTypename: true,
queryTransformer: addTypename,
dataIdFromObject: (result) => {
if (result.id && result.__typename) { // eslint-disable-line no-underscore-dangle
@@ -24,3 +25,4 @@ export const client = new ApolloClient({
});
export default client;