sidferreira / aor-firebase-client

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

Cannot read property 'then' of undefined #29

Closed jaysig closed 6 years ago

jaysig commented 6 years ago

I'm having an issue with loading my data. I get a popup that says Cannot read property then of undefined and I'm assuming that means it can not load the data.

App.js

import React from 'react';
import UserIcon from 'material-ui/svg-icons/social/group';

import { Admin, Resource } from 'admin-on-rest';
import { UserList } from './Users';
import { RestClient, AuthClient } from 'aor-firebase-client';
import config from './app.json'  // IT PULLS IN MY CONFIG AS EXPECTED

const trackedResources = ['users, connections']

const App = () => (
    <Admin restClient={RestClient(trackedResources, config.firebaseConfig)} authClient={AuthClient}>
        <Resource name="users" list={UserList} icon={UserIcon} />
    </Admin>
);

export default App;

Users.js

import React from 'react';
import { List, Datagrid, EmailField, TextField } from 'admin-on-rest';

export const UserList = (props) => (
    <List title="All users" {...props}>
        <Datagrid>
            <TextField source="company" />
            <TextField source="name" />
            <TextField source="paymentId" />
            <EmailField source="email" />
        </Datagrid>
    </List>
);

schema

users
   id
     name
     company
     email
     paymentId
jaysig commented 6 years ago

I realized this was caused by trying to pull in connections, but not having a list for it. That fixed the error with then undefined, but it seems I am able to only view data when I removed the authClient. Otherwise, it just hangs and upon refresh wants me to log in again.

eyalabadi98 commented 6 years ago

any updates on this?

sidferreira commented 6 years ago

@eyalabadi98 (also @grahamlyus @shrmnk ) I'm recovering from a surgery and this December was wild. I'm about to finish the v0.2.0, which had a LOT of changes. But I'm having a hard time to finish the tests and stuff. Anyone willing to help, will mean a LOT. Please check https://github.com/sidferreira/aor-firebase-client/tree/v0.2.0_wip

Things needed:

sidferreira commented 6 years ago

@eyalabadi98 @jaysig check the v0.2.0 branch