Remove baseURL from packages/jsonrpc#createRemoteClient
This commit is contained in:
parent
19f0993088
commit
5cc20ccd8e
@ -80,7 +80,7 @@ describe('createActions', () => {
|
||||
|
||||
function getClient() {
|
||||
const remoteClient = createRemoteClient<IService>(
|
||||
baseUrl, '/service', keys<IService>())
|
||||
baseUrl + '/service', keys<IService>())
|
||||
const client = createActions(remoteClient, 'myService')
|
||||
|
||||
const defaultState = {
|
||||
|
||||
@ -6,7 +6,6 @@ import {
|
||||
TAllActions,
|
||||
TReduxHandlers,
|
||||
} from './types'
|
||||
import {createRemoteClient} from './remote'
|
||||
|
||||
export function createActions<T, ActionType extends string>(
|
||||
client: TAsyncified<T>,
|
||||
|
||||
@ -65,7 +65,7 @@ describe('remote', () => {
|
||||
describe('idempotent method invocation (GET)', () => {
|
||||
it('creates a proxy for remote service', async () => {
|
||||
const rpc = createRemoteClient<IService>(
|
||||
baseUrl, '/myService', IServiceKeys)
|
||||
baseUrl + '/myService', IServiceKeys)
|
||||
const result = await rpc.fetchItem({a: 10}, {b: 20})
|
||||
expect(result).toEqual({a: 10, b: 20})
|
||||
})
|
||||
@ -74,7 +74,7 @@ describe('remote', () => {
|
||||
describe('method invocation (POST)', () => {
|
||||
it('creates a proxy for remote service', async () => {
|
||||
const rpc = createRemoteClient<IService>(
|
||||
baseUrl, '/myService', IServiceKeys)
|
||||
baseUrl + '/myService', IServiceKeys)
|
||||
const result = await rpc.add(3, 7)
|
||||
expect(result).toBe(3 + 7)
|
||||
})
|
||||
|
||||
@ -8,15 +8,12 @@ export const createNumberGenerator = (val: number) => () => ++val
|
||||
export const constantId = (val: string) => () => val
|
||||
|
||||
export function createRemoteClient<T>(
|
||||
baseUrl: string,
|
||||
url: string,
|
||||
methods: Array<FunctionPropertyNames<T>>,
|
||||
getNextRequestId: TRequestIdGenerator<string | number> = constantId('c'),
|
||||
idempotentMethodRegex = IDEMPOTENT_METHOD_REGEX,
|
||||
) {
|
||||
const axios = Axios.create({
|
||||
baseURL: baseUrl,
|
||||
})
|
||||
const axios = Axios.create()
|
||||
|
||||
async function createRequest(
|
||||
id: string | number | null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user