File tree Expand file tree Collapse file tree 2 files changed +27
-12
lines changed
apps/dashboard/src/app/team/[team_slug]/(team)/~/engine Expand file tree Collapse file tree 2 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,15 @@ function EngineInstanceLayoutContent(props: {
8989 ) ;
9090 }
9191
92- if ( permission . status === 401 || permission . status === 500 ) {
92+ if ( permission . status === 500 ) {
93+ return (
94+ < EngineErrorPage rootPath = { rootPath } >
95+ < p > Engine Instance Could Not Be Reached </ p >
96+ </ EngineErrorPage >
97+ ) ;
98+ }
99+
100+ if ( permission . status === 401 ) {
93101 return (
94102 < EngineErrorPage rootPath = { rootPath } >
95103 < div >
Original file line number Diff line number Diff line change @@ -2,16 +2,23 @@ export async function getEngineAccessPermission(params: {
22 authToken : string ;
33 instanceUrl : string ;
44} ) {
5- const res = await fetch ( `${ params . instanceUrl } auth/permissions/get-all` , {
6- method : "GET" ,
7- headers : {
8- "Content-Type" : "application/json" ,
9- Authorization : `Bearer ${ params . authToken } ` ,
10- } ,
11- } ) ;
5+ try {
6+ const res = await fetch ( `${ params . instanceUrl } auth/permissions/get-all` , {
7+ method : "GET" ,
8+ headers : {
9+ "Content-Type" : "application/json" ,
10+ Authorization : `Bearer ${ params . authToken } ` ,
11+ } ,
12+ } ) ;
1213
13- return {
14- ok : res . ok , // has access if this is true
15- status : res . status ,
16- } ;
14+ return {
15+ ok : res . ok , // has access if this is true
16+ status : res . status ,
17+ } ;
18+ } catch {
19+ return {
20+ ok : false ,
21+ status : 500 ,
22+ } ;
23+ }
1724}
You can’t perform that action at this time.
0 commit comments