This commit is contained in:
peter
2019-11-18 14:52:42 +01:00
parent 82bb96678c
commit 871005d584
15 changed files with 164 additions and 86 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
module.exports = {
externals: ['http'],
externals: ['http', 'fs'],
node: {global: true, fs: 'empty'}
}
@@ -1,12 +1,12 @@
import { Injectable } from "@angular/core";
import {RPCSocket} from 'rpclibrary/js/src/Frontend'
import { Token, Auth, User, _Class, FrontcraftFeatureIfc, LoginManagerIfc, SomeOf, } from '../../../../../backend/Types/Types'
import { Token, Auth, User, _Class, FrontcraftFeatureIfc, SomeOf, FrontcraftIfc, } from '../../../../../backend/Types/Types'
import { CookieService } from 'ngx-cookie-service';
@Injectable()
export class LoginApiService{
private socket:RPCSocket & LoginManagerIfc;
private socket:RPCSocket & FrontcraftIfc;
private auth:Auth
private privSocket: RPCSocket & SomeOf<FrontcraftFeatureIfc>
@@ -14,7 +14,7 @@ export class LoginApiService{
private cookieSvc : CookieService
){}
getUnprivilegedSocket = () : RPCSocket & LoginManagerIfc => this.socket
getUnprivilegedSocket = () : RPCSocket & FrontcraftIfc => this.socket
private getPrivilegedSocket = async (auth:Auth) : Promise<RPCSocket & SomeOf<FrontcraftFeatureIfc>> => {
if(this.privSocket) return this.privSocket
@@ -85,7 +85,7 @@ export class LoginApiService{
}
initialize = async () : Promise<RPCSocket> => {
const sock = await RPCSocket.makeSocket<LoginManagerIfc>(20000, window.location.hostname)
const sock = await RPCSocket.makeSocket<FrontcraftIfc>(20000, window.location.hostname)
this.socket = sock
const cookie = this.getCookie()