Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
presets: ["es2015", "react","stage-1"]
}
2 changes: 1 addition & 1 deletion client/App-Client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AppRoutes from '../common/AppRoutes.js';

//状态管理
import {Provider} from 'react-redux';
import configureStore from '../common/store/store.js';
import configureStore from '../common/store/index.js';


// `__INITIAL_STATE__` 来自服务器端渲染
Expand Down
20 changes: 0 additions & 20 deletions client/Layout.jsx

This file was deleted.

Empty file removed client/component/Edit.jsx
Empty file.
21 changes: 0 additions & 21 deletions client/component/Footer.jsx

This file was deleted.

16 changes: 0 additions & 16 deletions client/component/Header.jsx

This file was deleted.

1 change: 0 additions & 1 deletion client/component/Layout.jsx

This file was deleted.

Empty file removed client/component/Posts.jsx
Empty file.
Empty file removed client/component/Signin.jsx
Empty file.
Empty file removed client/component/Signup.jsx
Empty file.
Empty file removed client/component/signput.jsx
Empty file.
28 changes: 9 additions & 19 deletions common/AppRoutes.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
import React from 'react';
import {Route, Redirect} from 'react-router';

import Layout from '../client/Layout.jsx';//布局页面
import Signin from '../client/component/Signin.jsx';//登入,签到
import Signout from '../client/component/signput.jsx';//登出
import Signup from '../client/component/Signup.jsx';//注册
import Posts from '../client/component/Posts.jsx';//文章页


import NotFoundPage from './NotFoundPage.jsx';//错误页
import {Route, IndexRoute} from 'react-router';

import Layout from './components/Layout.jsx';//布局页面
import Counterpage from './containers/Counterpage.jsx';
import Todopage from './containers/Todopage.jsx';
import Indexpage from './components/Indexpage.jsx';


//注意这个重定向路由
const AppRoutes = (
<Route path="/" component={Layout}>
<Redirect from="/" to="/posts" />
<Route path="signin" component={Signin}/>
<Route path="signup" component={Signup}/>
<Route path="signout" component={Signout}/>
<Route path="posts" component={Posts}>
<Route path=":postId" component={Post}/>
<Route path=":postId/edit" component={Edit}/>
</Route>
<Route path="*" component={NotFoundPage}/>
<IndexRoute component={Indexpage} />
<Route path="counter" component={Counterpage}/>
<Route path="todo" component={Todopage}/>
</Route>
);

Expand Down
Empty file removed common/NotFoundPage.jsx
Empty file.
26 changes: 26 additions & 0 deletions common/action/counteraction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import request from 'axios';
import fetch from 'isomorphic-fetch';

export const ADD_COUNT = 'ADD_COUNT';

export const ASYNC_REQUEST_ADD ="ASYNC_REQUEST_ADD";//异步请求中
export const ASYNC_RECEIVE_ADD ="ASYNC_RECEIVE_ADD";//成功收获数据



export const counterAction=()=> {//同步
return {
type: ADD_COUNT
}
}

const AsyncCounterAction=()=>{//异步
return dispatch=>{
dispatch({type:ASYNC_REQUEST_ADD});//先分发一个action表明请求中
return fetch('/api/posts')
.then(response=>response.json())
.then(json=>dispatch({type:ASYNC_RECEIVE_ADD, data:json}));
}
}

export default AsyncCounterAction;
122 changes: 0 additions & 122 deletions common/action/posts.js

This file was deleted.

10 changes: 10 additions & 0 deletions common/action/todoaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const ADD_TODO = 'ADD_TODO';

const todoAction=(todoTxt)=> {
return {
type: ADD_COUNT,
todo:todoTxt
}
}

export default todoAction;
104 changes: 0 additions & 104 deletions common/action/user.js

This file was deleted.

Loading