-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Fix] Import/Export Page Not Working
- Loading branch information
Showing
8 changed files
with
122 additions
and
37 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
apps/gauzy/src/app/pages/import-export/external-redirect/external-redirect.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'ngx-external-redirect', | ||
template: '' | ||
}) | ||
export class ExternalRedirectComponent implements OnInit { | ||
constructor() {} | ||
|
||
ngOnInit() { | ||
console.log('Redirecting to external URL'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/ui-core/core/src/lib/guards/external-redirect.guard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot } from '@angular/router'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ExternalRedirectGuard { | ||
/** | ||
* Checks if navigation can proceed. | ||
* | ||
* @param route - The activated route snapshot containing route parameters. | ||
* @returns {boolean} - Returns false to prevent navigation to the route and true to allow navigation. | ||
*/ | ||
canActivate(route: ActivatedRouteSnapshot): boolean { | ||
const externalUrl = route.paramMap.get('redirect'); | ||
|
||
// If an external URL is provided in the route parameters | ||
if (externalUrl) { | ||
window.open(externalUrl, '_blank'); // Open the URL in a new tab | ||
return false; // Prevent navigation to the current route | ||
} | ||
|
||
return true; // Allow navigation if no external URL is found | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './invite.guard'; | ||
export * from './permission.guard'; | ||
export * from './role.guard'; | ||
export * from './external-redirect.guard'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters