Skip to content

Commit 43678a0

Browse files
committed
slightly improve URL handling
1 parent 38e08aa commit 43678a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

assets/js/editor/Editor.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import * as describe from '@openfn/describe-package';
66
import createCompletionProvider from './magic-completion';
77
import { initiateSaveAndRun } from '../common';
88

9+
const LOCAL_ADAPTORS_ROOT = 'http://localhost:5000';
10+
911
async function* fetchDTSListing(specifier: string) {
1012
if (specifier.endsWith('@local')) {
1113
const lang = specifier
1214
.replace('@local', '')
1315
.replace('@openfn/language-', '');
14-
const url = `http://localhost:5000/packages/${lang}/types`;
16+
const url = `${LOCAL_ADAPTORS_ROOT}/packages/${lang}/types`;
1517
const r = await fetch(url, { headers: { Accept: 'application/json' } });
1618
const json = await r.json();
1719
for (const f of json.files) {
@@ -24,7 +26,7 @@ async function* fetchDTSListing(specifier: string) {
2426
const fetchFile = async (path: string) => {
2527
if (path.includes('@local')) {
2628
path = path.replace('@openfn/language-', '').replace('@local', '');
27-
const url = `http://localhost:5000/packages/${path}`;
29+
const url = `${LOCAL_ADAPTORS_ROOT}/packages/${path}`;
2830
return fetch(url, { headers: { Accept: 'text/plain' } }).then(r =>
2931
r.text()
3032
);

0 commit comments

Comments
 (0)