diff --git a/src/useOkapiKy.js b/src/useOkapiKy.js index 669ba7d6f..22fdef09e 100644 --- a/src/useOkapiKy.js +++ b/src/useOkapiKy.js @@ -1,7 +1,7 @@ import ky from 'ky'; import { useStripes } from './StripesContext'; -export default (tenant) => { +export default ({ tenant } = {}) => { const { locale = 'en', timeout = 30000, tenant: currentTenant, token, url } = useStripes().okapi; return ky.create({ diff --git a/src/useOkapiKy.test.js b/src/useOkapiKy.test.js index 41fbc71a2..1a58e3208 100644 --- a/src/useOkapiKy.test.js +++ b/src/useOkapiKy.test.js @@ -76,7 +76,7 @@ describe('useOkapiKy', () => { } }; - const { result } = renderHook(() => useOkapiKy('monkey')); + const { result } = renderHook(() => useOkapiKy({ tenant: 'monkey' })); result.current.hooks.beforeRequest[0](r); expect(r.headers.set).toHaveBeenCalledWith('X-Okapi-Tenant', 'monkey');