Skip to content

Commit

Permalink
fix: fetch simple-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
BatLeDev committed Nov 8, 2024
1 parent e703ad3 commit dc5a2c1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
10 changes: 6 additions & 4 deletions ui/src/components/private-access.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ async function listSuggestions () {
}
loading.value = true
const orgsResponse = await $fetch('/simple-directory/api/organizations', {
params: { q: search.value }
const orgsResponse = await $fetch(`${$sitePath}/simple-directory/api/organizations`, {
params: { q: search.value },
baseURL: $sitePath
})
const orgs = orgsResponse.results.map((r: any) => ({ ...r, type: 'organization' }))
const usersResponse = await $fetch('/simple-directory/api/users', {
params: { q: search.value }
const usersResponse = await $fetch(`${$sitePath}/simple-directory/api/users`, {
params: { q: search.value },
baseURL: $sitePath
})
const users = usersResponse.results.map((r: any) => ({ ...r, type: 'user' }))
suggestions.value = localPatch.value.privateAccess.concat(orgs, users)
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/processing/processing-actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const confirmRemove = withUiNotif(
async () => {
inDelete.value = true
await $fetch(`${$apiPath}/processings/${properties.processing?._id}`, {
await $fetch(`/processings/${properties.processing?._id}`, {
method: 'DELETE'
})
Expand All @@ -256,13 +256,13 @@ const confirmRemove = withUiNotif(
)
const getWebhookKey = async () => {
webhookKey.value = await $fetch(`${$apiPath}/processings/${properties.processing?._id}/webhook-key`)
webhookKey.value = await $fetch(`/processings/${properties.processing?._id}/webhook-key`)
}
const triggerExecution = withUiNotif(
async () => {
hasTriggered.value = true
let link = `${$apiPath}/processings/${properties.processing?._id}/_trigger`
let link = `/processings/${properties.processing?._id}/_trigger`
if (triggerDelay.value > 0) link += `?delay=${triggerDelay.value}`
await $fetch(link, { method: 'POST' })
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/processings-actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const createProcessing = withUiNotif(
async () => {
inCreate.value = true
const processing = await $fetch(`${$apiPath}/processings`, {
const processing = await $fetch('/processings', {
method: 'POST',
body: JSON.stringify(newProcessing.value)
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/run/run-list-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const formatDate = (date: string) => dayjs(date).format('DD/MM/YYYY HH:mm')
const duration = (start: string, end: string) => dayjs(end).from(dayjs(start), true)
const kill = async () => {
await $fetch(`${$apiPath}/runs/${props.run._id}/_kill`, {
await $fetch(`/runs/${props.run._id}/_kill`, {
method: 'POST'
})
}
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/admin/plugins.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const pluginLocked = ref(null) as Ref<string | null>
const install = withUiNotif(
async (plugin: AvailablePlugin) => {
pluginLocked.value = `${plugin.name}-${plugin.distTag}`
await $fetch(`${$apiPath}/plugins`, {
await $fetch('/plugins', {
method: 'POST',
body: JSON.stringify(plugin)
})
Expand All @@ -300,7 +300,7 @@ const install = withUiNotif(
const uninstall = withUiNotif(
async (plugin: InstalledPlugin) => {
pluginLocked.value = `${plugin.name}-${plugin.distTag}`
await $fetch(`${$apiPath}/plugins/${plugin.id}`, {
await $fetch(`/plugins/${plugin.id}`, {
method: 'DELETE'
})
installedPluginsFetch.refresh()
Expand Down Expand Up @@ -336,7 +336,7 @@ async function update (plugin: InstalledPlugin) {
async function saveConfig (plugin: InstalledPlugin) {
pluginLocked.value = `${plugin.name}-${plugin.distTag}`
await $fetch(`${$apiPath}/plugins/${plugin.id}/config`, {
await $fetch(`/plugins/${plugin.id}/config`, {
method: 'PUT',
body: JSON.stringify({ ...plugin.config })
})
Expand All @@ -345,7 +345,7 @@ async function saveConfig (plugin: InstalledPlugin) {
async function saveAccess (plugin: InstalledPlugin) {
pluginLocked.value = `${plugin.name}-${plugin.distTag}`
await $fetch(`${$apiPath}/plugins/${plugin.id}/access`, {
await $fetch(`/plugins/${plugin.id}/access`, {
method: 'PUT',
body: JSON.stringify({ ...plugin.access })
})
Expand Down
6 changes: 3 additions & 3 deletions ui/src/pages/processings/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ onMounted(async () => {
})
async function fetchProcessing () {
processing.value = await $fetch(`${$apiPath}/processings/${processingId}`)
processing.value = await $fetch(`/processings/${processingId}`)
if (processing.value) editProcessing.value = { ...processing.value }
}
async function fetchPlugin () {
if (processing.value?.plugin) {
plugin.value = await $fetch(`${$apiPath}/plugins/${processing.value.plugin}`)
plugin.value = await $fetch(`/plugins/${processing.value.plugin}`)
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ const patch = withUiNotif(
if (!valid.value || !canAdminProcessing.value) return
edited.value = true
await $fetch(`${$apiPath}/processings/${processingId}`, {
await $fetch(`/processings/${processingId}`, {
method: 'PATCH',
body: editProcessing.value
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/runs/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function getIcon (step: Record<string, any>) {
onMounted(async () => {
loading.value = true
run.value = await $fetch(`${$apiPath}/runs/${runId}`)
run.value = await $fetch(`/runs/${runId}`)
if (!run.value) return
ws?.subscribe(`processings/${run.value.processing._id}/run-log`, onRunLog)
Expand Down

0 comments on commit dc5a2c1

Please sign in to comment.