Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7584d20

Browse files
show authentication message instead of redirect of unauthorized users
1 parent6882445 commit7584d20

File tree

1 file changed

+53
-13
lines changed

1 file changed

+53
-13
lines changed

‎client/packages/lowcoder/src/appView/AppViewInstance.tsx‎

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { AUTH_LOGIN_URL } from "constants/routesURL";
1212
import{AuthSearchParams}from"constants/authConstants";
1313
import{saveAuthSearchParams}from"pages/userAuth/authUtils";
1414
import{Suspense,lazy}from"react";
15+
importFlexfrom"antd/es/flex";
16+
import{TacoButton}from"components/button";
1517

1618
constAppView=lazy(
1719
()=>import('./AppView')
@@ -35,6 +37,8 @@ export interface AppViewInstanceOptions<I = any> {
3537
moduleInputs?:I;
3638
}
3739

40+
letisAuthButtonClicked=false;
41+
3842
exportclassAppViewInstance<I=any,O=any>{
3943
privatecomp:RootComp|null=null;
4044
privateprevOutputs:any=null;
@@ -44,6 +48,7 @@ export class AppViewInstance<I = any, O = any> {
4448
baseUrl:"https://api-service.lowcoder.cloud",
4549
webUrl:"https://app.lowcoder.cloud",
4650
};
51+
privateauthorizedUser:boolean=true;
4752

4853
constructor(privateappId:string,privatenode:Element,privateroot:Root,options:AppViewInstanceOptions={}){
4954
Object.assign(this.options,options);
@@ -81,7 +86,15 @@ export class AppViewInstance<I = any, O = any> {
8186
[AuthSearchParams.redirectUrl]:encodeURIComponent(window.location.href),
8287
[AuthSearchParams.loginType]:null,
8388
})
84-
window.location.href=`${webUrl}${AUTH_LOGIN_URL}`;
89+
// window.location.href = `${webUrl}${AUTH_LOGIN_URL}`;
90+
this.authorizedUser=false;
91+
return{
92+
data:{
93+
orgCommonSettings:undefined,
94+
applicationDSL:{},
95+
moduleDSL:{},
96+
}
97+
};
8598
}
8699
});
87100

@@ -143,18 +156,45 @@ export class AppViewInstance<I = any, O = any> {
143156
privateasyncrender(){
144157
constdata=awaitthis.dataPromise;
145158
this.root.render(
146-
<StyleSheetManagertarget={this.nodeasHTMLElement}>
147-
<Suspensefallback={null}>
148-
<AppView
149-
appId={this.appId}
150-
dsl={data.appDsl}
151-
moduleDsl={data.moduleDslMap}
152-
moduleInputs={this.options.moduleInputs}
153-
onCompChange={(comp)=>this.handleCompChange(comp)}
154-
onModuleEventTriggered={(eventName)=>this.emit("moduleEventTriggered",[eventName])}
155-
/>
156-
</Suspense>
157-
</StyleSheetManager>
159+
this.authorizedUser ?(
160+
<StyleSheetManagertarget={this.nodeasHTMLElement}>
161+
<Suspensefallback={null}>
162+
<AppView
163+
appId={this.appId}
164+
dsl={data.appDsl}
165+
moduleDsl={data.moduleDslMap}
166+
moduleInputs={this.options.moduleInputs}
167+
onCompChange={(comp)=>this.handleCompChange(comp)}
168+
onModuleEventTriggered={(eventName)=>this.emit("moduleEventTriggered",[eventName])}
169+
/>
170+
</Suspense>
171+
</StyleSheetManager>
172+
) :(
173+
<Flexvertical={true}align="center"justify="center">
174+
<h4>This resource needs authentication.</h4>
175+
{!isAuthButtonClicked ?(
176+
<TacoButton
177+
buttonType="primary"
178+
onClick={()=>{
179+
isAuthButtonClicked=true;
180+
window.open(`${this.options.webUrl}${AUTH_LOGIN_URL}`,'_blank');
181+
this.render();
182+
}}
183+
>
184+
Login
185+
</TacoButton>
186+
) :(
187+
<TacoButton
188+
buttonType="primary"
189+
onClick={()=>{
190+
window.location.reload();
191+
}}
192+
>
193+
Refresh
194+
</TacoButton>
195+
)}
196+
</Flex>
197+
)
158198
);
159199
}
160200

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp