Skip to content

Commit

Permalink
清理註解的 code 與修正 bug (#168)
Browse files Browse the repository at this point in the history
* Remove status constants from actions

* clean

* CS
  • Loading branch information
mark86092 authored Jun 24, 2017
1 parent 1290ede commit 261be2f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
16 changes: 0 additions & 16 deletions src/actions/experienceSearch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fetchUtil from '../utils/fetchUtil';
// import status from '../constants/status';

export const SET_SORT = 'SET_TSET_SORTYPE';
export const SET_SEARCH_TYPE = 'SET_SEARCH_TYPE';
Expand Down Expand Up @@ -48,19 +47,6 @@ export const fetchExperiences = (cond, val, page) => (dispatch, getState) => {
let objCond;
let hasMore = false;


// DON'T open the following dispatch if <InfiniteScroll> is used
// (<InfiniteScroll> has loading component as well)

// dispatch({
// type: SET_LOADING_STATUS,
// loadingStatus: status.FETCHING,
// prevCond: cond,
// prevValue: val,
// prevPage: page,
// });


if (cond === 'searchBy') {
url = `${url}&search_by=${data.searchBy}&search_query=${val}`;

Expand All @@ -85,7 +71,6 @@ export const fetchExperiences = (cond, val, page) => (dispatch, getState) => {
.then(result => {
hasMore = (start + limit) < result.total;
dispatch(Object.assign(objCond, {
loadingStatus: status.FETCHED,
prevCond: cond,
prevValue: val,
// prevPage: page,
Expand All @@ -101,7 +86,6 @@ export const fetchExperiences = (cond, val, page) => (dispatch, getState) => {
})
.catch(error => {
dispatch(Object.assign(objCond, {
loadingStatus: status.ERROR,
prevCond: cond,
prevValue: val,
// prevPage: (page ? page - 1 : page),
Expand Down
34 changes: 0 additions & 34 deletions src/components/ExperienceSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,20 @@ import InfiniteScroll from 'react-infinite-scroller';
import Checkbox from 'common/form/Checkbox';
import Loader from 'common/Loader';
import { Section, Wrapper } from 'common/base';
// import Alert from 'common/Alert';

import styles from './ExperienceSearch.module.css';
import Searchbar from './Searchbar';
import ExperienceBlock from './ExperienceBlock';
import WorkingHourBlock from './WorkingHourBlock';
import { fetchExperiences } from '../../actions/experienceSearch';
import status from '../../constants/status';

// let cmpAlert;

class ExperienceSearch extends Component {
static fetchData({ store: { dispatch } }) {
return dispatch(fetchExperiences('sort', '', 0));
}

static propTypes = {
// setSort: PropTypes.func.isRequired,
setSearchType: PropTypes.func.isRequired,
// setIndustry: PropTypes.func.isRequired,
// setSearchBy: PropTypes.func.isRequired,
setKeyword: PropTypes.func.isRequired,
fetchExperiences: PropTypes.func.isRequired,
fetchMoreExperiences: PropTypes.func.isRequired,
Expand Down Expand Up @@ -81,11 +74,6 @@ class ExperienceSearch extends Component {
<Section Tag="main" pageTop paddingBottom>
<Helmet title="面試 ‧ 工作經驗" />
<Wrapper size="l">
{/*
<Alert ref={c => { cmpAlert = c; }}>
<p>test</p>
</Alert>
*/}
<div className={styles.container}>
<aside className={styles.aside}>
<section>
Expand Down Expand Up @@ -122,26 +110,6 @@ class ExperienceSearch extends Component {
/>
))
}
{/*
<div className={styles.splitter} />
{
[
{ label: '全部', value: 'all' },
{ label: '金融業', value: 'finance' },
{ label: '製造業', value: 'manufacturing' },
{ label: '運輸業', value: 'transportation' },
{ label: '科技業', value: 'technology' },
].map(o => (
<Radio
key={o.value} id={`industry-${o.value}`}
label={o.label} value={o.value}
onChange={setIndustry}
checked={data.industry === o.value}
/>
))
}
*/}
</aside>

<div className={styles.content}>
Expand All @@ -155,8 +123,6 @@ class ExperienceSearch extends Component {
fetchExperiencesAndWorkings={this.fetchExperiencesAndWorkings}
/>

{data.loadingStatus === status.FETCHING && <Loader />}

{data.searchQuery &&
<div className={styles.searchResult}>
找到 {data.experienceCount} 筆與 &quot;{data.searchQuery}&quot; 相關的資料
Expand Down

0 comments on commit 261be2f

Please sign in to comment.