mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add document management store
This commit is contained in:
@@ -100,6 +100,35 @@ export class AuthService {
|
||||
|
||||
}
|
||||
|
||||
async loginContenteProduction(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
|
||||
|
||||
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
|
||||
this.opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
|
||||
let response: any;
|
||||
|
||||
try {
|
||||
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/LoginJwt", '', this.opts).toPromise();
|
||||
|
||||
|
||||
if(saveSession) {
|
||||
/* this.SetSession(response, user) */
|
||||
this.storageService.store('userContentProduction',response)
|
||||
this.storageService.get('userContentProduction').then((value) =>{
|
||||
console.log('JWW', value.AuthorizationJwt);
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
return response
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// async UpdateLogin() {}
|
||||
|
||||
SetSession(response: LoginUserRespose, user:UserForm) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { GetTasksListType } from '../models/GetTasksListType';
|
||||
import { fullTaskList } from '../models/dailyworktask.model';
|
||||
import { ChangeProfileService } from './change-profile.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { StorageService } from './storage.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -18,10 +19,13 @@ export class ProcessesService {
|
||||
authheader = {};
|
||||
loggeduser: LoginUserRespose;
|
||||
headers: HttpHeaders;
|
||||
headers2: HttpHeaders;
|
||||
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private changeProfileService: ChangeProfileService
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private storageSevice: StorageService
|
||||
) {
|
||||
|
||||
this.loggeduser = SessionStore.user;
|
||||
@@ -32,6 +36,8 @@ export class ProcessesService {
|
||||
this.setHeader()
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +45,11 @@ export class ProcessesService {
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
|
||||
this.headers2 = new HttpHeaders();
|
||||
this.headers2 = this.headers2.set('Authorization',"bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyNjIiLCJ1bmlxdWVfbmFtZSI6IkdpbHNvbiBNYW51ZWwiLCJlbWFpbCI6ImdpbHNvbi5tYW51ZWxAZ2FiaW5ldGVkaWdpdGFsLmxvY2FsIiwicm9sZSI6IlNlY3JldMOhcmlvIEdlcmFsIiwiZ3JvdXBzaWQiOiJHYWJpbmV0ZSBkZSBUZWNub2xvZ2lhcyBkZSBJbmZvcm1hw6fDo28iLCJvcmdhbmljZW50aXR5aWREIjoiMTA2IiwibmJmIjoxNjg4NTg0NTYzLCJleHAiOjE3MjAxMjA1NjMsImlhdCI6MTY4ODU4NDU2MywiaXNzIjoiOGIxMzBhN2YwLWM3YjctNDdzMjMtOWE4ZC1kNTlhMDE5YWY3NDkiLCJhdWQiOiJkMjh3dzE0NTMtM2M2OC00MWFkLThiNmMtYTUzNDUzODNlMGMyIn0.QDCrQsCH59GQMoudZTHyCMwwHYVwz1mZkLTzvzAwh64"
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
uploadFile(formData:any){
|
||||
@@ -107,6 +118,7 @@ export class ProcessesService {
|
||||
}
|
||||
|
||||
GetTask(serialnumber:string): Observable<any> {
|
||||
|
||||
const geturl = environment.apiURL + 'Tasks/FindTask';
|
||||
let params = new HttpParams();
|
||||
|
||||
@@ -119,6 +131,18 @@ export class ProcessesService {
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetDraftByID(id:string): Observable<any> {
|
||||
const geturl = environment.apiPCURL + `Documents/${id}`;
|
||||
let params = new HttpParams();
|
||||
|
||||
/* params = params.set("serialNumber", serialnumber); */
|
||||
|
||||
let options = {
|
||||
headers: this.headers2,
|
||||
/* params: params */
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
SetTaskToPending(serialNumber:string): Observable<any>{
|
||||
const geturl = environment.apiURL + 'Tasks/SetTaskPending';
|
||||
|
||||
Reference in New Issue
Block a user