mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Add new SiteData resolver on query to give access to site name, url, etc.
This commit is contained in:
parent
b6ceeedc87
commit
2ad26e2d80
2 changed files with 24 additions and 1 deletions
|
@ -1,8 +1,9 @@
|
|||
import './oauth_config.js';
|
||||
export * from './apollo_server.js';
|
||||
import './intl_polyfill.js';
|
||||
export * from './query.js';
|
||||
import './site.js';
|
||||
|
||||
export * from './query.js';
|
||||
export * from './meteor_patch.js';
|
||||
export * from '../modules/index.js';
|
||||
export * from './mutations.js';
|
||||
|
|
22
packages/vulcan-lib/lib/server/site.js
Normal file
22
packages/vulcan-lib/lib/server/site.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { addGraphQLSchema, addGraphQLResolvers, addGraphQLQuery } from '../modules/graphql.js';
|
||||
import { getSetting } from '../modules/settings.js';
|
||||
|
||||
const siteSchema = `
|
||||
type Site {
|
||||
title: String
|
||||
url: String
|
||||
}
|
||||
`;
|
||||
addGraphQLSchema(siteSchema);
|
||||
|
||||
const siteResolvers = {
|
||||
Query: {
|
||||
SiteData(root, args, context) {
|
||||
return {title: getSetting('title'), url: getSetting('siteUrl', Meteor.absoluteUrl())}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addGraphQLResolvers(siteResolvers);
|
||||
|
||||
addGraphQLQuery(`SiteData: Site`);
|
Loading…
Add table
Reference in a new issue