I’ve got a quick javascript question.
Say I’ve got RootFile.js
import UserApi from './UserApi'
export default class RootFile {
get userApi() {
return UserApi;
}
};
and then I got UserApi.js
import Auth from './auth';
import Profile from './profile';
const merged = {
...new Auth,
...new Profile
}
export default merged;
and then I got separate functionality files likeauth.js
or profile.js
.
auth.js
export default class Auth{
authLog(){
console.log("DONE");
//Gotta find a way to run this.
}
}
profile.js
export default class Profile{
profileLog(){
console.log("DONE");
//Gotta find a way to run this.
}
}
Now I want to be able to call:
import RootFile from './RootFile'
RootFile.userApi.profileLog();
//and
RootFile.userApi.authLog();
I can't get that to work, RootFile.userApi
is a typeof object
, but authLog
is undefined
.
What am I doing wrong?