mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
Little cleanup for admin services
This commit is contained in:
@@ -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);
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user