1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 121x 2x 121x 121x | // @flow import type { Adapter } from './types' let currentAdapter /** * Sets or gets the api client instance */ export default function apiClient ( adapter?: Adapter, options: { [key: string]: any } = {} ): Adapter { if (adapter) { currentAdapter = Object.assign({}, adapter, options) } Iif (!currentAdapter) { throw new Error('You must set an adapter first!') } return currentAdapter } |