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: {
89
89
) ;
90
90
}
91
91
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 ) {
93
101
return (
94
102
< EngineErrorPage rootPath = { rootPath } >
95
103
< div >
Original file line number Diff line number Diff line change @@ -2,16 +2,23 @@ export async function getEngineAccessPermission(params: {
2
2
authToken : string ;
3
3
instanceUrl : string ;
4
4
} ) {
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
+ } ) ;
12
13
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
+ }
17
24
}
You can’t perform that action at this time.
0 commit comments