-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release' into chore/side-by-side-tests
- Loading branch information
Showing
15 changed files
with
121 additions
and
114 deletions.
There are no files selected for viewing
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
26 changes: 13 additions & 13 deletions
26
app/client/src/api/services/ConsolidatedPageLoadApi/api.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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { api } from "api/core"; | ||
import type { InitConsolidatedApi } from "sagas/InitSagas"; | ||
import type { ConsolidatedApiParams } from "./types"; | ||
import { ConsolidatedApiUtils } from "./url"; | ||
|
||
const BASE_URL = "v1/consolidated-api"; | ||
const VIEW_URL = `${BASE_URL}/view`; | ||
const EDIT_URL = `${BASE_URL}/edit`; | ||
export const getConsolidatedPageLoadDataView = async ( | ||
params: ConsolidatedApiParams, | ||
) => { | ||
const viewUrl = ConsolidatedApiUtils.getViewUrl(params); | ||
|
||
export const getConsolidatedPageLoadDataView = async (params: { | ||
applicationId?: string; | ||
defaultPageId?: string; | ||
}) => { | ||
return api.get<InitConsolidatedApi>(VIEW_URL, { params }); | ||
return api.get<InitConsolidatedApi>(viewUrl); | ||
}; | ||
|
||
export const getConsolidatedPageLoadDataEdit = async (params: { | ||
applicationId?: string; | ||
defaultPageId?: string; | ||
}) => { | ||
return api.get<InitConsolidatedApi>(EDIT_URL, { params }); | ||
export const getConsolidatedPageLoadDataEdit = async ( | ||
params: ConsolidatedApiParams, | ||
) => { | ||
const editUrl = ConsolidatedApiUtils.getEditUrl(params); | ||
|
||
return api.get<InitConsolidatedApi>(editUrl); | ||
}; |
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,5 @@ | ||
export interface ConsolidatedApiParams { | ||
applicationId?: string; | ||
defaultPageId?: string; | ||
branchName?: string; | ||
} |
25 changes: 25 additions & 0 deletions
25
app/client/src/api/services/ConsolidatedPageLoadApi/url.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 pickBy from "lodash/pickBy"; | ||
import identity from "lodash/identity"; | ||
import type { ConsolidatedApiParams } from "./types"; | ||
|
||
export class ConsolidatedApiUtils { | ||
private static BASE_URL = "v1/consolidated-api"; | ||
private static VIEW_URL = `${this.BASE_URL}/view`; | ||
private static EDIT_URL = `${this.BASE_URL}/edit`; | ||
|
||
static getViewUrl = (requestParams: ConsolidatedApiParams) => { | ||
// Remove undefined values from the requestParams object | ||
const queryParamsObject = pickBy(requestParams, identity); | ||
const queryParamsString = new URLSearchParams(queryParamsObject).toString(); | ||
|
||
return `${this.VIEW_URL}?${queryParamsString}`; | ||
}; | ||
|
||
static getEditUrl = (requestParams: ConsolidatedApiParams) => { | ||
// Remove undefined values from the requestParams object | ||
const queryParamsObject = pickBy(requestParams, identity); | ||
const queryParamsString = new URLSearchParams(queryParamsObject).toString(); | ||
|
||
return `${this.EDIT_URL}?${queryParamsString}`; | ||
}; | ||
} |
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
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
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
Oops, something went wrong.