const publisherVideosReducer = (state: string, action: { type: string, payload: any}) => {
  let tmp
  switch (action.type) {
    case 'add':
      tmp = state.split(',').filter((i: any) => i !== `${action.payload.id}` && i !== '')
      tmp[tmp.length] = `${action.payload.id}`
      return tmp.join(',')
    case 'remove':
      return state.split(',').filter((i: any) => i !== `${action.payload.id}` && i !== '').join(',')
    default:
      return state || ''
  }
}

export default publisherVideosReducer
