File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
+ import { assembleUrl } from ' ../util' ;
2
3
export let uuid;
3
4
4
5
function resumeExecution () {
5
- fetch (' http://localhost:9009/ unlock' , {
6
+ fetch (assembleUrl ( ' / unlock' ) , {
6
7
headers: {
7
8
' pd-id' : uuid
8
9
}
Original file line number Diff line number Diff line change 1
1
import { writable } from 'svelte/store' ;
2
+ import { assembleUrl } from './util' ;
2
3
3
4
export const messageStore = writable ( [ ] ) ;
4
5
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' ) ) ;
12
7
13
8
eventSource . onmessage = function ( message ) {
14
9
messageStore . update ( m => {
Original file line number Diff line number Diff line change
1
+ export function assembleUrl ( path ) {
2
+ let url = '' ;
3
+
4
+ if ( ! isProduction ) {
5
+ url = 'http://localhost:9009' ;
6
+ }
7
+
8
+ return url + path ;
9
+ }
You can’t perform that action at this time.
0 commit comments