Skip to content

Commit

Permalink
fix: storeSetPage() didn´t handle the different type of page selector…
Browse files Browse the repository at this point in the history
…s correctly
  • Loading branch information
olzzon authored and olzzon committed Oct 19, 2020
1 parent 82ac921 commit 5425603
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
10 changes: 7 additions & 3 deletions client/components/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Channel from './Channel'
import '../assets/css/Channels.css'
import { Store } from 'redux'
import {
SET_PAGE, storeSetPage, storeShowSettings, storeShowStorage
storeSetPage,
storeShowSettings,
storeShowStorage,
} from '../../server/reducers/settingsActions'
import ChannelRouteSettings from './ChannelRouteSettings'
import ChanStrip from './ChanStrip'
Expand Down Expand Up @@ -83,9 +85,11 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {

handlePages(type: PageType, i: number | string) {
if (typeof i === 'string') {
this.props.dispatch(storeSetPage( type, i))
this.props.dispatch(storeSetPage(type, i))
} else {
this.props.dispatch(storeSetPage(type , i * this.props.settings.pageLength))
this.props.dispatch(
storeSetPage(type, i * this.props.settings.pageLength)
)
}
}

Expand Down
18 changes: 14 additions & 4 deletions server/reducers/settingsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,19 @@ export const storeSetServerOnline = (serverOnline: boolean) => {
}
}
export const storeSetPage = (pageType: PageType, id: number | string) => {
return {
type: SET_PAGE,
pageType: pageType,
id: id,
if (typeof id === 'string') {
return {
type: SET_PAGE,
pageType: pageType,
id: id,
start: 0,
}
} else {
return {
type: SET_PAGE,
pageType: pageType,
id: '',
start: id,
}
}
}

0 comments on commit 5425603

Please sign in to comment.