我在我的角度应用程序中使用 Angular NGRX 进行状态管理。在调度登录操作时,我CognitoUser从我正在使用的登录服务接收对象AWS amplify service。
当我调度 LoginSuccess 操作来传递此对象时,我收到错误TypeError: Cannot freeze。登录成功操作已调度,但减速器中未收到数据对象。
这是我的效果代码
export class LoginEffects {
login$ = createEffect(() =>
this.actions$.pipe(
ofType(LoginActions.login),
switchMap((action) =>
from(this.authService.login(action.username, action.password))
),
catchError((error) => of(LoginActions.loginError(error))),
map((user) => LoginActions.loginSuccess(user))
)
);
// ... other effects
constructor(
private actions$: Actions,
private authService: AuthService,
private router: Router
) {}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我将此响应用户分配给另一个像这样的对象
const obj = { ...user };
Run Code Online (Sandbox Code Playgroud)
然后我在减速器中接收数据,但对于CognitoUser对象,我没有在减速器中接收数据。
我如何CognitoUser在减速器中传递对象?
我有一个 Angular 项目,我必须在其中实现数据传输付款。但我无法生成付款标志。
我正在按照此链接(在此处输入链接描述)给出的流程来生成标志。
但我无法实现它。
我正在使用 Angular 库 crypto-js 生成 HMAC-SHA-256 签名字符串。
这是我的 JavaScript 代码。
const merchantId = 'xxxxxxx';
const refNo = '1234567890';
const amount = 0;
const currency = 'CHF';
const theme = 'DT2015';
const paymentmethod = 'VIS';
const stringSs = merchantId+amount+currency+refNo;
const base = 16;
// My Hmac Key
const s = 'fa3d0ea1772cf21e53158283e4f123ebf1eb1ccfb15619e2fc91ee6860a2e5e48409e902b610ce5dc6f7f77fab8affb60d69b2a7aa9acf56723d868d36ab3f32';
// Step 1: Code to generate hex to byte of hmac key
const a = s.replace(/../g, '$&_').slice (0, -1).split ('_').map ((x) …Run Code Online (Sandbox Code Playgroud)