Skip to content

Commit

Permalink
Use processURLAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
benjick committed Jun 4, 2020
1 parent 5acb823 commit b0fdc35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/vsf-storyblok-module/components/global/Cms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script>
import config from 'config'
import fetch from 'isomorphic-fetch'
import { processURLAddress } from '@vue-storefront/core/helpers'
import { loadScript } from '../../helpers'
export default {
Expand All @@ -31,7 +32,7 @@ export default {
this.$emit('input', value.content ? value.content : value)
},
async fetchStory () {
const url = `${config.storyblok.endpoint}/get-by-uuid?uuid=${this.uuid}`
const url = processURLAddress(`${config.storyblok.endpoint}/get-by-uuid?uuid=${this.uuid}`)
const response = await fetch(url)
const json = await response.json()
this.loading = false
Expand Down
5 changes: 3 additions & 2 deletions packages/vsf-storyblok-module/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ActionTree, ActionContext } from 'vuex'
import config from 'config'
import RootState from '@vue-storefront/core/types/RootState'
import { TaskQueue } from '@vue-storefront/core/lib/sync'
import { processURLAddress } from '@vue-storefront/core/helpers'
import qs from 'qs'

const fetchStory = async url => {
Expand Down Expand Up @@ -34,7 +35,7 @@ export const actions: ActionTree<StoryblokState, RootState> = {
return state.previewToken
}

const url = `${config.storyblok.endpoint}/validate-editor/?${qs.stringify(query)}`
const url = processURLAddress(`${config.storyblok.endpoint}/validate-editor/?${qs.stringify(query)}`)
const { result: { previewToken } }: any = await TaskQueue.execute({
url,
silent: true
Expand Down Expand Up @@ -66,7 +67,7 @@ export const actions: ActionTree<StoryblokState, RootState> = {
return cachedStory
}

const url = `${config.storyblok.endpoint}/story/${key}`.replace(/([^:]\/)\/+/g, '$1')
const url = processURLAddress(`${config.storyblok.endpoint}/story/${key}`.replace(/([^:]\/)\/+/g, '$1'))
const story = await fetchStory(url)

commit('setStory', { key, story })
Expand Down

0 comments on commit b0fdc35

Please sign in to comment.