Skip to content

Commit c7c0484

Browse files
committed
Fix path in assembleUrl
1 parent 7edbd2e commit c7c0484

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/Elements/PauseElement.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script>
2+
import { assembleUrl } from '../util';
23
export let uuid;
34
45
function resumeExecution() {
5-
fetch('http://localhost:9009/unlock', {
6+
fetch(assembleUrl('/unlock'), {
67
headers: {
78
'pd-id': uuid
89
}

src/messageStore.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import { writable } from 'svelte/store';
2+
import { assembleUrl } from './util';
23

34
export const messageStore = writable([]);
45

5-
let eventSource;
6-
7-
if (isProduction) {
8-
eventSource = new EventSource('/events');
9-
} else {
10-
eventSource = new EventSource('http://localhost:9009/events');
11-
}
6+
let eventSource = new EventSource(assembleUrl('/events'));
127

138
eventSource.onmessage = function (message) {
149
messageStore.update(m => {

src/util.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export function assembleUrl(path) {
2+
let url = '';
3+
4+
if (!isProduction) {
5+
url = 'http://localhost:9009';
6+
}
7+
8+
return url + path;
9+
}

0 commit comments

Comments
 (0)