我用来node-keytar在 Electron 应用程序中存储令牌。它使用承诺,因此我需要等待承诺解决才能获取令牌。
我尝试创建的效果将调用身份验证服务来获取令牌,然后使用 Angularhttp调用将该令牌发送到后端 API。这里的问题是调用 Effect 中的服务函数。由于服务功能需要await响应,keytar整个功能必须是async,但据我所知,没有办法使效果本身与关键字异步async。
我应该在这里使用不同的架构吗?我尝试过使用.then()并从内部返回成功操作,但这会引发类型错误。
效果(目前有错误Type Observable<{}> is not assignable to type Observable<Action>):
setAccount$: Observable<Action> = this.actions$.pipe(
ofType<SetCurrentAccountPending>(AccountActions.ActionTypes.SetCurrentAccountPending),
switchMap(action => {
return this.accountService.setCurrentAccount(action.payload).pipe(
map(
() => new AccountActions.SetCurrentAccountSuccess(action.payload)
),
catchError(() => {
return of(new AccountActions.SetCurrentAccountFailure());
})
);
})
);
Run Code Online (Sandbox Code Playgroud)
服务功能:
async setCurrentAccount(id: string) {
const password = await AccountHandler.getPasswordFromManager(id);
const body = {password: password};
return this.httpClient.post(environment.localApi + '/accounts/' + id, …Run Code Online (Sandbox Code Playgroud) 如果我有一个使用 Lombok 的课程:
\n\n@RequiredArgsConstructor\n@Getter\nclass Example {\n private final String id;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n并尝试将其反序列化
\n\n{\n \xe2\x80\x9cid\xe2\x80\x9d: \xe2\x80\x9ctest\xe2\x80\x9d\n}\nRun Code Online (Sandbox Code Playgroud)\n\nJackson 抛出一个异常,尽管至少提供了一个创建者,但它无法反序列化。
\n\n如果我再添加另一个final String向该类添加另一个字段,并将该字段添加到 JSON,则它会被反序列化,不会出现任何问题。
有谁知道\xe2\x80\x99s 这里发生了什么?如果只有一个字段,为什么无法反序列化?
\n我正在尝试使用Bootstrap开发工具包编写网站代码.我已经设置了一些带有几个链接的导航栏,但是我在添加一些自定义链接时遇到了一些麻烦.我将CSS添加到名为'navbar-social'的bootstrap.min.css文件中,该文件将用于存放导航栏的社交媒体图标.
我添加的图像很好,它们显示很棒.我遇到的问题是,当我添加一个链接到他们时,他们会脱离线并悬停在他们上面给他们一个我不想要的背景框.
我附上了一些截图和使用的代码,我不能为我的生活找出背景框的来源,因为检查样式似乎没有任何东西.我是CSS的新手,所以如果我遗漏了一些明显的东西,我会道歉.
LinkedIn未链接,其他链接:http://prntscr.com/2ob2b2
CSS代码添加到bootstrap.min.css.休息就是:
.navbar-social{
float:right !important;
padding:5px;
font-size:18px;
line-height:37px;
height:20px
}
Run Code Online (Sandbox Code Playgroud)
HTML :(在这种情况下删除了一个href)
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">REMOVED</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="">About</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Programming <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Java</a></li>
<li><a href="#">C++</a></li>
<li><a href="#">Actionscript 3.0</a></li>
</ul>
</li>
<li><a …Run Code Online (Sandbox Code Playgroud) 在超类中,我有:
abstract someMethod() throws someException;
Run Code Online (Sandbox Code Playgroud)
在子类中,我有:
someMethod(){/*do something*/}
Run Code Online (Sandbox Code Playgroud)
无需throws someException声明就可以这样做吗?是不是该throws someException声明是有默认不明确增加了吗?
我有一个名为的对象added,如下所示:
{
title: "test1",
startDate: "Mon Apr 15 2019 10:30:00 GMT-0500 (Central Daylight Time)",
endDate: "Mon Apr 15 2019 11:00:00 GMT-0500 (Central Daylight Time)",
allDay: false
}
Run Code Online (Sandbox Code Playgroud)
我试图通过执行以下操作来编辑此对象的startDate和endDate字段:
added = {
...added,
{added.startDate: "111", added.endDate: "222"}
}
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误,说
意外令牌,预期,
这样做的正确方法是什么?