未捕获(在承诺中)CustomPouchError

时间:2017-07-25 19:44:27

标签: javascript pouchdb

我正在创建一个动漫应用程序,当我尝试访问一个特定的动画时我有问题,该动画应该向我展示动画的章节列表然后当我点击特定的章节时,我将呈现的流动部分视频。

// npm packages
import React from 'react';
import {withRouter} from 'react-router-dom';

// my packages
import db from '../../db';

//access to all chapter of the series
export default withRouter(({series, history}) => {
  const openSeriesPage = async () => {
    // but you can use a location instead
    const location = {
      pathname: `/series${series._id}`,
      state: series,
    };

    const doc = await db.current.get('series');
    const update = {
      _id: 'series',
      data: series,
    };
    if (doc) {
      update._rev = doc._rev;
    }
    await db.current.put(update);

    history.push(location); // error in this particular part!!
  };

  return (
    <div className="tile is-parent is-3">
      <div className="tile is-child">
        <div className="card" onClick={openSeriesPage}>
          <div className="card-image">
            <figure className="image">
              <img src={series.image} alt={series.title} />
            </figure>
          </div>
          <div className="card-content">
            <div className="media">
              <div className="media-content">
                <p className="title is-4">{series.title}</p>
                <p className="subtitle is-6">Episodes: {series.count}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
});

这是错误

  

未捕获(承诺)CustomPouchError {状态:404,名称:“not_found”,消息:“缺失”,错误:true,原因:“缺失”...} history.push(location);

0 个答案:

没有答案