我试图耙我的heroku应用程序.
我运行了日志,这就是我得到的.
dhcp-v12-201774:staplesounds mattthomas$ heroku run rake db:migrate
Running rake db:migrate on musicfinal... up, run.2067
? ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
dhcp-v12-201774:staplesounds mattthomas$ heroku logs
2016-02-11T03:49:26.683947+00:00 heroku[api]: Enable Logplex by mattcthomas@me.com
2016-02-11T03:49:26.683947+00:00 heroku[api]: Release v2 created by mattcthomas@me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by mattcthomas@me.com
2016-02-11T03:50:20.892163+00:00 heroku[api]: Release v3 created by mattcthomas@me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Attach DATABASE resource by mattcthomas@me.com
2016-02-11T03:50:21.454068+00:00 heroku[api]: Release v4 created by mattcthomas@me.com
2016-02-11T03:50:21.778790+00:00 heroku[api]: Scale to web=1 by mattcthomas@me.com
2016-02-11T03:50:21.861786+00:00 heroku[api]: Deploy …Run Code Online (Sandbox Code Playgroud) 我正在尝试.svg使用TypeScript 将文件作为React组件导入。
根据React文档,这样做是这样的:
import { ReactComponent as Icon } from './Icon.svg';
在TypeScript文档之后,我添加了以下内容:
// custom.ts.d
declare module '*.svg' {
const content: any;
export default content;
}
Run Code Online (Sandbox Code Playgroud)
和
// tsconfig.json
{
...
"files": [
"custom.d.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
SVG正在渲染。但是我收到一个TypeScript错误:
[ts] Module '"*.svg"' has no exported member 'ReactComponent'. [2305]
这是我的完整tsconfig文件,如果有帮助的话:
{
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true,
"jsx": "react",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": …Run Code Online (Sandbox Code Playgroud) 如果用户是否经过身份验证,我正在使用Subject来进行通信.问题是,当我在重新加载时订阅组件中的主题时,主题返回undefined.
这是我的实现,此方法检查用户数据是否存储在本地存储中.如果它们存储在本地存储中,则Subject应设置为true.
user.service.ts
public auth_status:Subject<boolean> = new Subject<boolean>();
getCurrentUser(): User {
let storage = localStorage.getItem('current_user');
if (storage) {
return Json.parse(storage);
} else {
return null
}
};
getUserAuth() {
if (this.getCurrentUser() != null) {
this.auth_status.next(true);
console.log(this.auth_status);
} else {
this.auth_status.next(false);
console.log(this.auth_status);
}
return this.auth_status;
}
Run Code Online (Sandbox Code Playgroud)
navbar.component.ts
constructor(private _userService: UserService) {
this._userService.getUserAuth().subscribe(data => this.auth_status = data);
}
Run Code Online (Sandbox Code Playgroud)
this.auth_status在我的导航栏中切换*ngIf,显示登录或退出按钮
我已经尝试在订阅它之前调用该方法,但这似乎不起作用.
谢谢!
我正在尝试找到一种方法来模拟Next.js's getInitialProps。
我目前正在使用 cypress 运行 E2E 测试,但无法找到一种方法来模拟服务器端获取,而不需要启动模拟服务器来进行获取。我很好奇是否有人找到了更好的方法?
谢谢你!