Skip to content

Commit

Permalink
fix(client): api paths
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Feb 1, 2023
1 parent 278ffac commit 4cb76af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 5 additions & 3 deletions client/composables/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { OgImageOptions } from '../../src/types'
import { host, optionsPath, path, refreshTime, vnodePath } from '~/util/logic'
import { host, path, refreshTime } from '~/util/logic'
export async function fetchOptions() {
const { data: options } = await useAsyncData<OgImageOptions>(() => {
return $fetch(optionsPath.value, {
return $fetch('/api/og-image-options', {
baseURL: host,
query: { path: path.value },
})
}, {
watch: [path, refreshTime],
Expand All @@ -13,7 +14,8 @@ export async function fetchOptions() {

export async function fetchVNodes() {
const { data: options } = await useAsyncData<OgImageOptions>(() => {
return $fetch(vnodePath.value, {
return $fetch('/api/og-image-vnode', {
query: { path: path.value },
baseURL: host,
})
}, {
Expand Down
2 changes: 0 additions & 2 deletions client/util/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export const description = ref<string | null>(null)
export const hostname = window.location.host
export const host = `${window.location.protocol}//${hostname}`
export const path = ref('/')
export const optionsPath = computed(() => joinURL(path.value as string, '__og_image__/options'))
export const vnodePath = computed(() => joinURL(path.value as string, '__og_image__/vnode'))

export const refreshSources = useDebounceFn(() => {
refreshTime.value = Date.now()
Expand Down

0 comments on commit 4cb76af

Please sign in to comment.