menu name added
This commit is contained in:
parent
777dabd086
commit
24fc01b54d
|
@ -6,6 +6,7 @@ import { MaterialModule } from 'app/commons/ui/material/material.module';
|
||||||
import { QRCodeModule } from 'angularx-qrcode';
|
import { QRCodeModule } from 'angularx-qrcode';
|
||||||
|
|
||||||
import { COMPONENTS } from './component';
|
import { COMPONENTS } from './component';
|
||||||
|
import {SERVICES} from "../../probe/service";
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
@ -18,6 +19,9 @@ import { COMPONENTS } from './component';
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
COMPONENTS,
|
COMPONENTS,
|
||||||
]
|
],
|
||||||
|
providers: [
|
||||||
|
SERVICES,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class MemberModule { }
|
export class MemberModule { }
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import {MemberTotpService} from './member-totp.service';
|
||||||
|
|
||||||
|
export const SERVICES = [
|
||||||
|
MemberTotpService,
|
||||||
|
];
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { TestBed, inject } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MemberTotpService } from './member-totp.service';
|
||||||
|
|
||||||
|
describe('MemberTotpService', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [MemberTotpService]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', inject([MemberTotpService], (service: MemberTotpService) => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
}));
|
||||||
|
});
|
30
src/packages/settings/member/service/member-totp.service.ts
Normal file
30
src/packages/settings/member/service/member-totp.service.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { RPCClient } from '../../../core/rpc/client/RPCClient';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { MemberTotp } from '../model/MemberTotp';
|
||||||
|
import { Member } from '../../../member/model';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class MemberTotpService {
|
||||||
|
|
||||||
|
public constructor(
|
||||||
|
private rpcClient: RPCClient,
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public createTotp(): Observable<MemberTotp[]> {
|
||||||
|
// Todo Store get member object
|
||||||
|
|
||||||
|
return this.rpcClient.call<MemberTotp[]>('MemberTotpService.createTotp', {id: '1'});
|
||||||
|
}
|
||||||
|
|
||||||
|
public regist(): Observable<boolean> {
|
||||||
|
const param = {
|
||||||
|
Member: {id: 1,},
|
||||||
|
MemberTotp: {id: 1, secretCode: 'dkdkdkdk'},
|
||||||
|
code: '123123'
|
||||||
|
};
|
||||||
|
return this.rpcClient.call<boolean>('MemberTotpService.regist', param);
|
||||||
|
}
|
||||||
|
}
|
4
src/packages/settings/member/store/totp/index.ts
Normal file
4
src/packages/settings/member/store/totp/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './totp.action';
|
||||||
|
// export * from './totp.effect';
|
||||||
|
// export * from './totp.reducer';
|
||||||
|
// export * from './totp.state';
|
63
src/packages/settings/member/store/totp/totp.action.ts
Normal file
63
src/packages/settings/member/store/totp/totp.action.ts
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { RESTError } from 'packages/core/rest/error';
|
||||||
|
|
||||||
|
import { DomainMember } from 'packages/domain/model';
|
||||||
|
import {Member} from "../../../../member/model";
|
||||||
|
|
||||||
|
export enum ActionType {
|
||||||
|
CreateTotp = '[member.totp] CreateTotp',
|
||||||
|
CreateTotpSuccess = '[member.totp] CreateTotpSuccess',
|
||||||
|
CreateTotpFailure = '[member.totp] CreateTotpFailure',
|
||||||
|
|
||||||
|
Regist = '[member.auth] SigninCookie',
|
||||||
|
RegistSuccess = '[member.auth] SigninCookieSuccess',
|
||||||
|
RegistFailure = '[member.auth] SigninCookieFailure',
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateTotp implements Action {
|
||||||
|
readonly type = ActionType.CreateTotp;
|
||||||
|
|
||||||
|
constructor(public payload: {key: string, uri: string}) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateTotpSuccess implements Action {
|
||||||
|
readonly type = ActionType.CreateTotpSuccess;
|
||||||
|
|
||||||
|
constructor(public payload: {key: string, uri: string}) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateTotpFailure implements Action {
|
||||||
|
readonly type = ActionType.CreateTotpFailure;
|
||||||
|
|
||||||
|
constructor(public payload: RESTError) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export class Regist implements Action {
|
||||||
|
readonly type = ActionType.Regist;
|
||||||
|
|
||||||
|
constructor(public payload: {member: Member, secretCode: string, code: string}) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RegistSuccess implements Action {
|
||||||
|
readonly type = ActionType.RegistSuccess;
|
||||||
|
|
||||||
|
constructor(public payload: void) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RegistFailure implements Action {
|
||||||
|
readonly type = ActionType.RegistFailure;
|
||||||
|
|
||||||
|
constructor(public payload: RESTError) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Actions =
|
||||||
|
| CreateTotp
|
||||||
|
| CreateTotpSuccess
|
||||||
|
| CreateTotpFailure
|
||||||
|
| Regist
|
||||||
|
| RegistSuccess
|
||||||
|
| RegistFailure
|
||||||
|
;
|
Loading…
Reference in New Issue
Block a user