Skip to content

Commit

Permalink
fix: read FM settings via SettingsManager client
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Aug 12, 2020
1 parent af8f8cc commit 94ac1a2
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions packages/api-plugin-page-builder-resolvers-mongodb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,7 @@ export default () => [
// TODO: in "content" field. We will only store an immutable file "key", which is enough for us to
// TODO: construct the whole path to the file (we'll only load URL prefix via GRAPHQL)
try {
if (!context.files) {
context.files = {
settings: await driver.getClient().runOperation({
collection: "Settings",
operation: [
"findOne",
{
key: "file-manager",
deleted: { $ne: true }
}
]
})
};
}

const filesSettings = await context.settingsManager.getSettings("file-manager");
const result = await driver.getClient().runOperation({
collection: "File",
operation: ["findOne", { id, deleted: { $ne: true } }]
Expand All @@ -62,7 +48,7 @@ export default () => [

return {
id: result.id,
src: get(context, "files.settings.data.srcPrefix") + result.key
src: get(filesSettings, "srcPrefix") + result.key
};
} catch (e) {
return null;
Expand Down

0 comments on commit 94ac1a2

Please sign in to comment.