我在管理应用程序中的身份验证时遇到问题,它实际上正在工作,但问题是当我刷新页面时,即使我没有注销,我也会被重定向到登录页面!\n这是路由的代码页 :
\n\nexport const fakeAuth = {\n isAuthenticated: false,\n authenticate(cb) {\n this.isAuthenticated = true\n setTimeout(cb, 1000)\n },\n signout(cb) {\n this.isAuthenticated = false\n setTimeout(cb, 1000)\n }\n}\n\nconst PrivateRoute = ({ component: Component, ...rest }) => (\n <Route {...rest} render={(props) => (\n fakeAuth.isAuthenticated === true\n ? <Component {...props} />\n : <Redirect to={{\n pathname: \'/login\',\n state: { from: props.location }\n }} />\n )} />\n)\n\nReactDOM.render(\n <Router history={hist}>\n <Switch>\n <Route path="/login" component={Login} />\n <PrivateRoute path="/admin" component={AdminLayout} />\n <Redirect to="/admin/dashboard" />\n </Switch>\n </Router>,\n document.getElementById("root")\n);\nRun Code Online (Sandbox Code Playgroud)\n\n这是登录组件的代码: …
我从 GitHub 克隆了一个项目,并尝试使用 Composer 安装包,我安装的没有问题。我运行作曲家安装。不幸的是,我遇到了这些我无法弄清楚的错误,我该怎么办?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for tijsverkoyen/css-to-inline-styles 2.2.2 -> satisfiable by tijsverkoyen/css-to-inline-styles[2.2.2].
- tijsverkoyen/css-to-inline-styles 2.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 2
- Installation request for phar-io/manifest 1.0.3 -> satisfiable by phar-io/manifest[1.0.3].
- phar-io/manifest 1.0.3 requires ext-dom * -> the requested …Run Code Online (Sandbox Code Playgroud)