sessionId is added
This commit is contained in:
parent
6fab831ef5
commit
5924decae4
|
@ -1,4 +1,4 @@
|
|||
import { Inject, Injectable, Type } from '@angular/core';
|
||||
import { Inject, Injectable, OnInit, Type } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
|
||||
import * as jspb from 'google-protobuf';
|
||||
|
@ -9,7 +9,7 @@ import { Client } from 'app/modules/protobuf/models/core/network_pb';
|
|||
|
||||
import { ModuleConfig } from '../config/module-config';
|
||||
import { _MODULE_CONFIG } from '../config/token';
|
||||
import { Router } from '@angular/router';
|
||||
import { WebSessionStorageService } from 'app/core/web-storage/services/web-session-storage.service';
|
||||
|
||||
type DeserializeConstructor<T> = {
|
||||
new (): T;
|
||||
|
@ -30,9 +30,12 @@ export class NatsService {
|
|||
*/
|
||||
constructor(
|
||||
@Inject(_MODULE_CONFIG) private __config: ModuleConfig,
|
||||
@Inject(DOCUMENT) private __document: Document
|
||||
@Inject(DOCUMENT) private __document: Document,
|
||||
private __webSessionStorageService: WebSessionStorageService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Accessors
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
@ -54,6 +57,13 @@ export class NatsService {
|
|||
.then((conn) => {
|
||||
console.log('NATS connected', conn.info?.client_ip);
|
||||
this.__conn = conn;
|
||||
|
||||
this.__webSessionStorageService
|
||||
.watch('SESSION_ID')
|
||||
.subscribe((sessionId) => {
|
||||
console.log('sessionId in NatsService', sessionId);
|
||||
});
|
||||
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
|
@ -71,7 +81,7 @@ export class NatsService {
|
|||
return new Promise<R>((resolve, reject) => {
|
||||
let c = new Client();
|
||||
c.setClientIp(this.__conn?.info?.client_ip + '');
|
||||
c.setSessionId('');
|
||||
c.setSessionId(this.__webSessionStorageService.get('SESSION_ID'));
|
||||
c.setSiteUrl(this.__document.location.hostname);
|
||||
|
||||
let _opts: nats.RequestOptions = !!opts ? opts : { timeout: 3000 };
|
||||
|
|
|
@ -60,6 +60,7 @@ export abstract class WebStorageService {
|
|||
this.__storage.setItem(key, JSON.stringify(value));
|
||||
if (!this.__subjects.has(key)) {
|
||||
this.__subjects.set(key, new BehaviorSubject<any>(value));
|
||||
(this.__subjects.get(key) as BehaviorSubject<any>).next(value);
|
||||
} else {
|
||||
(this.__subjects.get(key) as BehaviorSubject<any>).next(value);
|
||||
}
|
||||
|
|
|
@ -8,24 +8,10 @@ import {
|
|||
ViewChild,
|
||||
ViewEncapsulation,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import {
|
||||
debounceTime,
|
||||
map,
|
||||
merge,
|
||||
Observable,
|
||||
Subject,
|
||||
switchMap,
|
||||
takeUntil,
|
||||
} from 'rxjs';
|
||||
import { map, merge, Observable, Subject, switchMap, takeUntil } from 'rxjs';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseConfirmationService } from '@fuse/services/confirmation';
|
||||
|
||||
|
@ -197,8 +183,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
*/
|
||||
__onClickSearch(): void {
|
||||
this.__isSearchOpened = !this.__isSearchOpened;
|
||||
|
||||
console.log('kkkk', this._identityService.captcha());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseAlertType } from '@fuse/components/alert';
|
||||
import { AuthService } from 'app/core/auth/auth.service';
|
||||
import { WebSessionStorageService } from 'app/core/web-storage/services/web-session-storage.service';
|
||||
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
|
||||
import { CaptchaResponse } from 'app/modules/protobuf/c2se/common/identity_pb';
|
||||
|
||||
|
@ -36,6 +37,7 @@ export class AuthSignInComponent implements OnInit {
|
|||
private _formBuilder: FormBuilder,
|
||||
private _router: Router,
|
||||
private _identityService: IdentityService,
|
||||
private __webSessionStorageService: WebSessionStorageService,
|
||||
private _sanitizer: DomSanitizer
|
||||
) {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user