Skip to content

Commit 8dc2f5e

Browse files
committed
slightly improve URL handling
1 parent 1a04c2b commit 8dc2f5e

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
@@ -7,12 +7,14 @@ import * as describe from '@openfn/describe-package';
77
import createCompletionProvider from './magic-completion';
88
import { initiateSaveAndRun } from '../common';
99

10+
const LOCAL_ADAPTORS_ROOT = 'http://localhost:5000';
11+
1012
async function* fetchDTSListing(specifier: string) {
1113
if (specifier.endsWith('@local')) {
1214
const lang = specifier
1315
.replace('@local', '')
1416
.replace('@openfn/language-', '');
15-
const url = `http://localhost:5000/packages/${lang}/types`;
17+
const url = `${LOCAL_ADAPTORS_ROOT}/packages/${lang}/types`;
1618
const r = await fetch(url, { headers: { Accept: 'application/json' } });
1719
const json = await r.json();
1820
for (const f of json.files) {
@@ -25,7 +27,7 @@ async function* fetchDTSListing(specifier: string) {
2527
const fetchFile = async (path: string) => {
2628
if (path.includes('@local')) {
2729
path = path.replace('@openfn/language-', '').replace('@local', '');
28-
const url = `http://localhost:5000/packages/${path}`;
30+
const url = `${LOCAL_ADAPTORS_ROOT}/packages/${path}`;
2931
return fetch(url, { headers: { Accept: 'text/plain' } }).then(r =>
3032
r.text()
3133
);

0 commit comments

Comments
 (0)