Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • R redux-rest-easy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 26
    • Merge requests 26
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Brigad
  • redux-rest-easy
  • Issues
  • #26
Closed
Open
Issue created Mar 08, 2018 by Administrator@rootContributor

Issues around `initializeNetworkHelpers` `TypeError: this.getToken is not a function`

Created by: beezenees

Regarding the initialization of network helpers, it would seem to me that the initializeNetworkHelpers function is not performing in the way it should be. It looks like what is happening is when I pass in a custom config, it inevitably resets itself to the DEFAULT_NETWORK_HELPERS config, which for me, still is not working (the this.getToken is not a function error occurs with me trying to use an overwritten config, or the default config.

Repo: https://github.com/Pinesy/radical

The custom config i'm trying to use (just trying to overwrite the getToken method)

const networkHelpers = {
  getToken: () => sessionStorage.getItem("auth_token")
};
initializeNetworkHelpers(networkHelpers);

I am calling initializeNetworkHelpers before any network requests being made.

This is an image of the error: image

When I click through to the error spot: image

Additional info: This is the resource I am trying to perform the retrieve method on.

import { createResource } from "@brigad/redux-rest-easy";

const products = createResource("products")({
  retrieve: {
    method: "GET",
    url: "/products",
    afterHook: () => console.log("Products retrieved successfuly")
  }
});

const {
  actions: { retrieve: { perform: retrieveProducts } },
  selectors: {
    resource: { getResource: getProducts },
    retrieve: { request: { isPerforming: isRetrievingProducts } }
  }
} = products;

export { retrieveProducts, getProducts, isRetrievingProducts };

The url is /products because in my CRA config, I have my local API proxied, "proxy": "http://localhost:8080/api"

Assignee
Assign to
Time tracking