sidferreira / aor-firebase-client

Firebase client for Admin on Rest
MIT License
57 stars 29 forks source link

authClient causing errors #2

Closed RWOverdijk closed 7 years ago

RWOverdijk commented 7 years ago

When using authClient I get the following error:

TypeError: __webpack_require__.i(...) is not a function
App
src/App.js:19
  16 | const trackedResources = ['configs'];
  17 | 
  18 | const App = () => (
> 19 |   <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient(firebaseConfig)}>
  20 |     <Resource name="Configs" list={ConfigList} edit={ConfigEdit} />
  21 |   </Admin>
  22 | );
View compiled

It works when removed. My code is really simple:

// in src/App.js
import React from 'react';
import {Admin, Resource} from 'admin-on-rest';
import {ConfigList, ConfigEdit} from './config';
import {RestClient, AuthClient} from 'aor-firebase-client';

const firebaseConfig = {
};

const trackedResources = ['configs'];

const App = () => (
  <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient(firebaseConfig)}>
    <Resource name="Configs" list={ConfigList} edit={ConfigEdit} />
  </Admin>
);

export default App;
RWOverdijk commented 7 years ago

I think the issue is that you shouldn't call it as a method, but just pass it in:

const App = () => (
  <Admin restClient={RestClient(trackedResources, firebaseConfig)} authClient={AuthClient}>
    <Resource name="Configs" list={ConfigList} edit={ConfigEdit} />
  </Admin>
);

Update:

I tested this using my own client (I need a provider) and it works fine.

sidferreira commented 7 years ago

@RWOverdijk you were right! Thanks a lot!