mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Refactor a bit
This commit is contained in:
parent
f189851355
commit
5dd7cd7554
19935
build/bundle.js
19935
build/bundle.js
File diff suppressed because one or more lines are too long
11
js/actions/artwork_list_actions.js
Normal file
11
js/actions/artwork_list_actions.js
Normal file
@ -0,0 +1,11 @@
|
||||
import alt from '../alt';
|
||||
|
||||
class ArtworkListActions {
|
||||
constructor() {
|
||||
this.generateActions(
|
||||
'updateArtworkList'
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
//export default alt.createAction(ArtworkListActions);
|
@ -6,7 +6,7 @@ import Router from 'react-router';
|
||||
import AscribeApp from './components/ascribe_app';
|
||||
import routes from './routes';
|
||||
|
||||
Router.run(routes, Router.HashLocation, (AscribeApp) => {
|
||||
Router.run(routes, Router.HistoryLocation, (AscribeApp) => {
|
||||
React.render(
|
||||
<AscribeApp />,
|
||||
document.getElementById('main')
|
||||
|
@ -1,11 +0,0 @@
|
||||
import alt from '../alt';
|
||||
|
||||
class ArtworkListActions {
|
||||
constructor() {
|
||||
this.generateActions(
|
||||
'updateArtworks'
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default alt.createAction(ArtworkListActions);
|
24
js/components/artwork_list.js
Normal file
24
js/components/artwork_list.js
Normal file
@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import ArtworkFetcher from '../fetchers/artwork_fetcher';
|
||||
import ArtworkListStore from '../stores/artwork_list_store';
|
||||
|
||||
|
||||
class ArtworkList extends React.Component {
|
||||
componentDidMount() {
|
||||
ArtworkFetcher.fetch().end();
|
||||
}
|
||||
|
||||
getInitialState() {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ul>
|
||||
<li>This is an artwork</li>
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default ArtworkList;
|
@ -1,13 +1,17 @@
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
|
||||
|
||||
var Link = Router.Link;
|
||||
var RouteHandler = Router.RouteHandler;
|
||||
|
||||
|
||||
class AscribeApp extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>ascribe all the things!</h1>
|
||||
<Link to="artworks">artworks</Link>
|
||||
<RouteHandler />
|
||||
</div>
|
||||
);
|
||||
|
@ -1,13 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
class ArtworkList extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<ul>
|
||||
<li>This is an artwork</li>
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default ArtworkList;
|
@ -1,9 +0,0 @@
|
||||
import alt from '../alt';
|
||||
|
||||
class ArtworkListStore {
|
||||
constructor() {
|
||||
this.artworkList = [];
|
||||
}
|
||||
};
|
||||
|
||||
export default alt.createStore(ArtworkListStore);
|
10
js/fetchers/artwork_fetcher.js
Normal file
10
js/fetchers/artwork_fetcher.js
Normal file
@ -0,0 +1,10 @@
|
||||
import request from 'superagent';
|
||||
|
||||
var ArtworkListFetcher = {
|
||||
fetch() {
|
||||
return request.get('http://staging.ascribe.io/api/users/')
|
||||
.auth('dimi@mailinator.com', '0000000000');
|
||||
}
|
||||
};
|
||||
|
||||
export default ArtworkListFetcher;
|
@ -2,13 +2,13 @@ import React from 'react';
|
||||
import Router from 'react-router';
|
||||
|
||||
import AscribeApp from './components/ascribe_app';
|
||||
import ArtworkList from './components/gui/artwork_list';
|
||||
import ArtworkList from './components/artwork_list';
|
||||
|
||||
var Route = Router.Route;
|
||||
|
||||
var routes = (
|
||||
<Route handler={AscribeApp}>
|
||||
<Route path="artworks" handler={ArtworkList} />
|
||||
<Route name="app" path="/" handler={AscribeApp}>
|
||||
<Route name="artworks" handler={ArtworkList} />
|
||||
</Route>
|
||||
);
|
||||
|
||||
|
15
js/stores/artwork_list_store.js
Normal file
15
js/stores/artwork_list_store.js
Normal file
@ -0,0 +1,15 @@
|
||||
import alt from '../alt';
|
||||
import ArtworkListActions from '../actions/artwork_list_actions';
|
||||
|
||||
class ArtworkListStore {
|
||||
constructor() {
|
||||
this.artworkList = [];
|
||||
this.bindActions(ArtworkListActions);
|
||||
}
|
||||
|
||||
onUpdateArtworkList(artworkList) {
|
||||
this.artworkList = artworkList;
|
||||
}
|
||||
};
|
||||
|
||||
export default alt.createStore(ArtworkListStore);
|
Loading…
Reference in New Issue
Block a user