Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benjick committed Feb 20, 2020
1 parent 49e80d2 commit 6cb5232
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions packages/vsf-storyblok-extension/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ function hook ({ config, db, storyblokClient }) {
await cacheInvalidate(config.storyblok)
return apiStatus(res)
} catch (error) {
console.log('Failed fetching story', error)
return apiStatus(res, {
error: 'Fetching story failed'
error: 'Webhook failed'
})
}
}
Expand Down
18 changes: 10 additions & 8 deletions packages/vsf-storyblok-extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = ({ config, db }) => {
if (hits.total === 0) {
throw new Error('Missing story')
}
let story = hits.hits[0]._source
const story = hits.hits[0]._source
if (typeof story.content === 'string') {
story.content = JSON.parse(story.content)
}
Expand All @@ -40,13 +40,15 @@ module.exports = ({ config, db }) => {
}
}

db.ping().then(async () => {
await fullSync(db, config, storyblokClient)
log('Stories synced!')
}).catch((error) => {
console.log('error', error)
log('Stories not synced!')
})
(async () => {
try {
await db.ping()
await fullSync(db, config, storyblokClient)
log('Stories synced!')
} catch (error) {
log('Stories not synced!')
}
})()

api.get('/story/', (req, res) => {
getStory(res, 'home')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
},
url () {
const formatUrl = url => this.isExternal ? url : (`/${url}`).replace(/^\/+/, '/')
let url = formatUrl(this.link.cached_url || this.link.url)
const url = formatUrl(this.link.cached_url || this.link.url)
const addStoreCode = get(config, 'storyblok.settings.appendStoreCodeFromHeader')
if (addStoreCode && this.storeCodeFromHeader && url.startsWith(`/${this.storeCodeFromHeader}/`)) {
return url.replace(`/${this.storeCodeFromHeader}/`, '/')
Expand Down
1 change: 1 addition & 0 deletions packages/vsf-storyblok-module/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const components = {

export function add (key: string, component: any, options: any = {}) {
if (components[key] && !options.force) {
// eslint-disable-next-line no-console
console.log(`Component with key ${key} already exists, skipping...`)
return
}
Expand Down

0 comments on commit 6cb5232

Please sign in to comment.