File tree Expand file tree Collapse file tree 3 files changed +9
-39
lines changed Expand file tree Collapse file tree 3 files changed +9
-39
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import axios from 'axios' ;
21
21
22
- let baseURL ;
23
-
24
- // nodejs development
25
- if ( window . location . port == 5173 ) {
26
- // Change port to 3005
27
- baseURL = 'http://localhost:3005/api/v1' ;
28
- } else {
29
- baseURL = '/api/v1' ;
30
- }
22
+ const baseURL = '/api/v1' ;
31
23
32
24
const instance = axios . create ( {
33
25
baseURL,
Original file line number Diff line number Diff line change @@ -25,14 +25,7 @@ export function getWebsocketURI() {
25
25
} else {
26
26
newURI = 'ws:' ;
27
27
}
28
- // nodejs development
29
- if ( window . location . port == 5173 ) {
30
- // Change port to 3005
31
- newURI += '//' + loc . hostname + ':3005' ;
32
- } else {
33
- newURI += '//' + loc . host ;
34
- }
35
- newURI += '/ws' ;
28
+ newURI += '//' + loc . host + '/ws' ;
36
29
console . log ( 'Websocket URI: "' + newURI + '"' ) ;
37
30
return newURI ;
38
31
}
Original file line number Diff line number Diff line change @@ -15,29 +15,14 @@ export default defineConfig({
15
15
} ,
16
16
server : {
17
17
proxy : {
18
- '/api/v1/features' : {
19
- bypass : ( req , res ) => {
20
- res . setHeader ( 'Content-Type' , 'application/json' ) ;
21
- res . end ( JSON . stringify ( { features : [ '' ] } ) ) ;
22
- } ,
18
+ '/api' : {
19
+ target : 'https://dmrhub.net' ,
20
+ changeOrigin : true ,
23
21
} ,
24
- '/api/v1/network/name' : {
25
- bypass : ( req , res ) => {
26
- res . setHeader ( 'Content-Type' , 'text/plain' ) ;
27
- res . end ( 'DMRHub' ) ;
28
- } ,
29
- } ,
30
- '/api/v1/me' : {
31
- bypass : ( req , res ) => {
32
- res . setHeader ( 'Content-Type' , 'application/json' ) ;
33
- res . end ( JSON . stringify ( { } ) ) ;
34
- } ,
35
- } ,
36
- '/api/v1/version' : {
37
- bypass : ( req , res ) => {
38
- res . setHeader ( 'Content-Type' , 'text/plain' ) ;
39
- res . end ( 'Test' ) ;
40
- } ,
22
+ '/ws' : {
23
+ target : 'wss://dmrhub.net' ,
24
+ ws : true ,
25
+ changeOrigin : true ,
41
26
} ,
42
27
} ,
43
28
} ,
You can’t perform that action at this time.
0 commit comments