Skip to content

Commit

Permalink
STCOR-747: Convert optional arg to object for useOkapiKy hook (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariia-aloshyna authored Oct 18, 2023
1 parent 38729db commit 8d7ac44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/useOkapiKy.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/useOkapiKy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 8d7ac44

Please sign in to comment.