Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未兑现的(承诺中的)错误_Javascript_Pouchdb - Fatal编程技术网

Javascript 未兑现的(承诺中的)错误

Javascript 未兑现的(承诺中的)错误,javascript,pouchdb,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 exp

我正在创建一个动画应用程序,当我试图访问一个特定的动画时,我遇到了问题,该动画应该向我显示该动画的章节列表,然后当我单击特定章节时,我将显示视频的流部分

// 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>
  );
});
//npm包
从“React”导入React;
从“react router dom”导入{withRouter};
//我的包裹
从“../../db”导入数据库;
//访问本系列的所有章节
使用路由器导出默认值({series,history})=>{
const openSeriesPage=async()=>{
//但是你可以用一个位置来代替
常数位置={
路径名:`/series${series.\u id}`,
国家:系列,
};
const doc=await db.current.get('series');
常数更新={
_id:'系列',
数据:系列,
};
国际单项体育联合会(doc){
更新。_版次=文件。_版次;
}
等待db.current.put(更新);
history.push(location);//此特定部分出错!!
};
返回(

{series.title}

剧集:{series.count}

); });
这就是错误所在

未捕获(承诺中)错误{状态:404,名称:“未找到”,消息:“丢失”,错误:true,原因:“丢失”…}历史。推送(位置)


哦,对不起,这是我第一次发帖。我会考虑下一次你应该删除图像并在这个问题中发布你的代码,否则它将被关闭,因为它不是,并且可能被否决,导致一个问题banUncaught(承诺中)错误{状态:404,名称:“not_found”,消息:“missing”,错误:true,原因:“missing”…}历史。推送(位置);请也发布db代码。使用try{}catch(){}修复此问题