Skip to content

Commit

Permalink
Rename for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandberger committed Jun 18, 2024
1 parent 04c786e commit a0a5867
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/components/Root/FFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/

import ms from 'ms';
import { okapi } from 'stripes-config';
import { okapi as okapiConfig } from 'stripes-config';
import {
setRtrTimeout
} from '../../okapiActions';
Expand Down Expand Up @@ -112,8 +112,8 @@ export class FFetch {
rotationP.then((rotationInterval) => {
this.logger.log('rtr', `rotation fired from rotateCallback; next callback in ${ms(rotationInterval)}`);
this.store.dispatch(setRtrTimeout(setTimeout(() => {
const okapiStore = this.store.getState().okapi;
rtr(this.nativeFetch, this.logger, this.rotateCallback, okapiStore);
const { okapi } = this.store.getState();
rtr(this.nativeFetch, this.logger, this.rotateCallback, okapi);
}, rotationInterval)));
});
};
Expand Down Expand Up @@ -174,12 +174,12 @@ export class FFetch {
*/
ffetch = async (resource, options = {}) => {
// FOLIO API requests are subject to RTR
if (isFolioApiRequest(resource, okapi.url)) {
if (isFolioApiRequest(resource, okapiConfig.url)) {
this.logger.log('rtrv', 'will fetch', resource);

// on authentication, grab the response to kick of the rotation cycle,
// then return the response
if (isAuthenticationRequest(resource, okapi.url)) {
if (isAuthenticationRequest(resource, okapiConfig.url)) {
this.logger.log('rtr', 'authn request');
return this.nativeFetch.apply(global, [resource, options && { ...options, ...OKAPI_FETCH_OPTIONS }])
.then(res => {
Expand Down Expand Up @@ -208,7 +208,7 @@ export class FFetch {
// tries to logout, the logout request will fail. And that's fine, just
// fine. We will let them fail, capturing the response and swallowing it
// to avoid getting stuck in an error loop.
if (isLogoutRequest(resource, okapi.url)) {
if (isLogoutRequest(resource, okapiConfig.url)) {
this.logger.log('rtr', 'logout request');

return this.nativeFetch.apply(global, [resource, options && { ...options, ...OKAPI_FETCH_OPTIONS }])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Root/token-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const isRotating = () => {
* @param {function} fetchfx native fetch function
* @param {@folio/stripes/logger} logger
* @param {function} callback
* @param {object} store
* @param {object} okapi
* @returns void
*/
export const rtr = (fetchfx, logger, callback, okapi) => {
Expand Down

0 comments on commit a0a5867

Please sign in to comment.