mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix chat and remove guid extension
This commit is contained in:
@@ -22,6 +22,8 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
null
|
||||
);
|
||||
|
||||
private excludedDomains = ['Login', environment.apiChatUrl]; // Add the domains you want to exclude
|
||||
|
||||
constructor(private http: HttpClient, private router: Router,) { }
|
||||
|
||||
|
||||
@@ -29,6 +31,11 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
request: HttpRequest<any>,
|
||||
next: HttpHandler
|
||||
): Observable<HttpEvent<any>> {
|
||||
|
||||
if (this.shouldExcludeDomain(request)) {
|
||||
return next.handle(request);
|
||||
}
|
||||
|
||||
if (SessionStore.user.Authorization) {
|
||||
request = this.addToken(request, SessionStore.user.Authorization);
|
||||
}
|
||||
@@ -44,23 +51,24 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
);
|
||||
}
|
||||
|
||||
private shouldExcludeDomain(request: HttpRequest<any>): boolean {
|
||||
const url = request.url.toLowerCase();
|
||||
return this.excludedDomains.some((domain) => url.includes(domain.toLowerCase()));
|
||||
}
|
||||
|
||||
private addToken(request: HttpRequest<any>, token: string) {
|
||||
|
||||
if(request.url.includes("Login")) {
|
||||
return request.clone({});
|
||||
} else {
|
||||
|
||||
return request.clone({
|
||||
setHeaders: {
|
||||
//'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
return request.clone({
|
||||
setHeaders: {
|
||||
//'Access-Control-Allow-Origin': '*',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private handle401Error(request: HttpRequest<any>, next: HttpHandler) {
|
||||
// if not getting the new token yet
|
||||
if (!this.isRefreshing) {
|
||||
this.isRefreshing = true;
|
||||
this.refreshTokenSubject.next(null);
|
||||
@@ -73,6 +81,7 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
// get new token
|
||||
return this.refreshTokenSubject.pipe(
|
||||
filter((token) => token != null),
|
||||
take(1),
|
||||
|
||||
@@ -370,7 +370,7 @@ export class ChatService {
|
||||
|
||||
async refreshtoken() {
|
||||
|
||||
/* if(this.headers && SessionStore.user.ChatData) {
|
||||
if(this.headers && SessionStore.user.ChatData) {
|
||||
this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
|
||||
let options = {
|
||||
headers: this.headers
|
||||
@@ -423,7 +423,7 @@ export class ChatService {
|
||||
} else if (!this.headers) {
|
||||
this.setheader()
|
||||
this.refreshtoken()
|
||||
} */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ export class NewPublicationPage implements OnInit {
|
||||
if(upload) {
|
||||
this.publication.Files = this.publication.Files.map((e:PublicationAttachmentEntity)=> {
|
||||
if(e.FileType == 'video') {
|
||||
e.OriginalFileName = e.chucksManager.path
|
||||
e.OriginalFileName = e.chucksManager.path.replace(".mp4", "")
|
||||
e.FileExtension = "mp4"
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ export class NewPublicationPage implements OnInit {
|
||||
if(upload) {
|
||||
this.publication.Files = this.publication.Files.map((e:PublicationAttachmentEntity)=> {
|
||||
if(e.FileType == 'video') {
|
||||
e.OriginalFileName = e.chucksManager.path
|
||||
e.OriginalFileName = e.chucksManager.path.replace(".mp4", "")
|
||||
e.FileExtension = "mp4"
|
||||
e.Base64 = ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user