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

Commitba05799

Browse files
raheeliftikhar5ludomikula
authored andcommitted
routing/navigation relative to subpath
1 parent3998986 commitba05799

File tree

7 files changed

+24
-9
lines changed

7 files changed

+24
-9
lines changed

‎client/packages/lowcoder/src/constants/apiConstants.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,18 @@ export const API_REQUEST_HEADERS: RawAxiosRequestHeaders = {
5252
"Content-Type":"application/json",
5353
};
5454

55-
exportconstSERVER_HOST=`${REACT_APP_API_SERVICE_URL??""}/__LOWCODER_BASEPATH_PLACEHOLDER__`;
55+
constnodeEnv=process.env.NODE_ENV??"development";
56+
constisDev=nodeEnv==="development";
57+
constDEV_SERVER_HOST=`${REACT_APP_API_SERVICE_URL??""}/`;
58+
constPROD_SERVER_HOST=`${REACT_APP_API_SERVICE_URL??""}/__LOWCODER_BASEPATH_PLACEHOLDER__`;
59+
60+
constcreateUrlByEnv=(baseUrl:string="")=>{
61+
constnodeEnv=process.env.NODE_ENV??"development";
62+
constisDev=nodeEnv==="development";
63+
returnisDev ?`${baseUrl}/` :`${baseUrl}/__LOWCODER_BASEPATH_PLACEHOLDER__`;
64+
}
65+
66+
exportconstSERVER_HOST=createUrlByEnv(REACT_APP_API_SERVICE_URL);
5667
exportconstASSETS_URI=(id:string)=>`${SERVER_HOST}/api/v1/assets/${id}`;
5768
exportconstUSER_HEAD_UPLOAD_URL=`${SERVER_HOST}/api/v1/users/photo`;
5869
exportconstORG_ICON_UPLOAD_URL=(orgId:string)=>`${SERVER_HOST}/api/v1/organizations/${orgId}/logo`;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// export const SERVER_HOST = `${REACT_APP_NODE_SERVICE_URL ?? ""}`;
22
// export const NPM_REGISTRY_URL = `${SERVER_HOST}/node-service/api/npm/registry`;
33
// export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/node-service/api/npm/package`;
4+
5+
import{SERVER_HOST}from"./apiConstants";
6+
47
exportconstASSETS_BASE_URL=`api/npm/package`;
5-
exportconstSERVER_HOST=`${REACT_APP_API_SERVICE_URL??""}`;
68
exportconstNPM_REGISTRY_URL=`${SERVER_HOST}/api/npm/registry`;
79
exportconstNPM_PLUGIN_ASSETS_BASE_URL=`${SERVER_HOST}/api/npm/package`;

‎client/packages/lowcoder/src/pages/setting/subscriptions/subscriptionCancel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function SubscriptionCancel() {
4343
constsession_id=query.get("session_id");
4444

4545
useEffect(()=>{
46-
window.location.replace(SUBSCRIPTION_SETTING);
46+
history.replace(SUBSCRIPTION_SETTING);
4747
},[]);
4848

4949
return(

‎client/packages/lowcoder/src/pages/userAuth/authUtils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ export function authRespValidate(
8383
if(doValidResponse(resp)){
8484
onAuthSuccess?.();
8585
sessionStorage.setItem("_just_logged_in_","true");
86-
history.replace(replaceUrl.replace(baseUrl,''));
86+
window.location.replace(replaceUrl.replace(baseUrl,''));
8787
}elseif(
8888
resp.data.code===SERVER_ERROR_CODES.EXCEED_MAX_USER_ORG_COUNT||
8989
resp.data.code===SERVER_ERROR_CODES.ALREADY_IN_ORGANIZATION
9090
){
9191
messageInstance.error(resp.data.message);
9292
// redirect after displaying the message for a second
93-
setTimeout(()=>window.location.replace(replaceUrl),1500);
93+
setTimeout(()=>history.replace(replaceUrl),1500);
9494
}else{
9595
throwError(resp.data.message);
9696
}

‎client/packages/lowcoder/src/redux/sagas/orgSagas.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { User } from "constants/userConstants";
3333
import{getUserSaga}from"redux/sagas/userSagas";
3434
import{GetMyOrgsResponse}from"@lowcoder-ee/api/userApi";
3535
importUserApifrom"@lowcoder-ee/api/userApi";
36+
importhistoryfrom"@lowcoder-ee/util/history";
3637

3738
exportfunction*updateGroupSaga(action:ReduxAction<UpdateGroupActionPayload>){
3839
try{
@@ -248,7 +249,7 @@ export function* switchOrgSaga(action: ReduxAction<{ orgId: string }>) {
248249
constresponse:AxiosResponse<ApiResponse>=yieldcall(OrgApi.switchOrg,action.payload.orgId);
249250
constisValidResponse:boolean=validateResponse(response);
250251
if(isValidResponse){
251-
window.location.replace(BASE_URL);
252+
history.replace(BASE_URL);
252253
}
253254
}catch(error:any){
254255
messageInstance.error(error.message);

‎client/packages/lowcoder/src/redux/sagas/userSagas.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { AuthSearchParams } from "constants/authConstants";
2626
import{saveAuthSearchParams}from"pages/userAuth/authUtils";
2727
import{initTranslator}from"i18n";
2828
import{fetchWorkspacesAction}from"../reduxActions/orgActions";
29+
importhistoryfrom"@lowcoder-ee/util/history";
2930

3031
functionvalidResponseData(response:AxiosResponse<ApiResponse>){
3132
returnresponse&&response.data&&response.data.data;
@@ -45,7 +46,7 @@ export function* getUserSaga() {
4546
constredirectUrl=newURL(redirectUri);
4647
redirectUrl.pathname=currentUrl.pathname;
4748
redirectUrl.search=currentUrl.search;
48-
window.location.replace(redirectUrl);
49+
history.replace(redirectUrl);
4950
return;
5051
}
5152
if(validateResponse(response)){
@@ -163,7 +164,7 @@ export function* logoutSaga(action: LogoutActionType) {
163164
if(isValidResponse){
164165
yieldput(logoutSuccess());
165166
localStorage.clear();
166-
window.location.replace(redirectURL);
167+
history.replace(redirectURL);
167168
}
168169
}catch(error){
169170
log.error(error);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import{createBrowserHistory}from"history";
2-
exportdefaultcreateBrowserHistory({basename:"__LOWCODER_BASEPATH_PLACEHOLDER__"});
2+
exportdefaultcreateBrowserHistory({basename:"/__LOWCODER_BASEPATH_PLACEHOLDER__"});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp