File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
packages/op-arcade-sdk/src Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ export const isTournament = writable(false);
1919export const tourneyStore = getTourneyStore ( ) ;
2020export const authStore = getAuthStore ( ) ;
2121
22+ export const NODE_API_URL = writable ( {
23+ dev : "http://127.0.0.1:3001/oparcade/api" ,
24+ prod : "http://op-arcade-dev.herokuapp.com/oparcade/api"
25+ } )
26+
2227export async function useServers ( options ) {
2328 let auth_provider = await get ( authStore ) . useServer ( options . auth_server ) ;
2429 let tourney_provider = await get ( tourneyStore ) . useServer ( options . tourney_server , auth_provider ) ;
Original file line number Diff line number Diff line change 11import CONSTANTS from '../constants.js'
22import * as nakamajs from '@heroiclabs/nakama-js' ;
33
4- // const axios = require('axios')
4+ import { get } from 'svelte/store'
5+ import { isProd , NODE_API_URL } from '../stores'
56import axios from 'axios'
67
78const TEST_ID = "test_id"
@@ -95,11 +96,9 @@ class NakamaTourneyProvider {
9596 }
9697 }
9798
98- const dev = 'http://127.0.0.1:3001/oparcade/api/tournaments/post-score'
99- const prod = 'http://op-arcade-dev.herokuapp.com/oparcade/api/tournaments/post-score'
100- const isDevelopment = false
101- const requestURL = isDevelopment ? dev : prod
102- const res = await axios . post ( requestURL , args , config )
99+ const { prod, dev} = get ( NODE_API_URL )
100+ const requestURL = get ( isProd ) ? prod : dev
101+ const res = await axios . post ( `${ requestURL } /tournaments/post-score` , args , config )
103102 return res
104103 } catch ( e ) {
105104 console . error ( "postScore failed [" + e . status + ":" + e . statusText + "]" ) ;
You can’t perform that action at this time.
0 commit comments