added fields page data api call
This commit is contained in:
parent
96958c12a0
commit
3567190c3a
3 changed files with 37 additions and 4 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -10911,7 +10911,7 @@
|
|||
},
|
||||
"node_modules/protobuf-ts": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#37e19bde4218b369e028606c009729112668ccc6",
|
||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#1b6076608722fff5290457b077604bb0b38d5499",
|
||||
"dependencies": {
|
||||
"protobufjs": "^6.8.8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ export default function BinsList(props: Props) {
|
|||
xs: 6,
|
||||
sm: 4,
|
||||
md: 3,
|
||||
lg: 2,
|
||||
lg: 1.5,
|
||||
}}
|
||||
key={i}
|
||||
className={classes.gridListTile}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,21 @@ export interface IFieldAPIContext {
|
|||
otherTeam?: string,
|
||||
asRoot?: boolean
|
||||
) => Promise<AxiosResponse<pond.ListFieldsResponse>>;
|
||||
fieldsPageData: (
|
||||
limit: number,
|
||||
offset: number,
|
||||
order?: "asc" | "desc",
|
||||
orderBy?: string,
|
||||
search?: string,
|
||||
otherTeam?: string,
|
||||
) => Promise<AxiosResponse<pond.ListFieldsPageDataResponse>>
|
||||
removeField: (key: string, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveFieldResponse>>;
|
||||
updateField: (
|
||||
key: string,
|
||||
field: pond.FieldSettings,
|
||||
asRoot?: true,
|
||||
otherTeam?: string
|
||||
) => Promise<AxiosResponse<pond.UpdateSiteResponse>>;
|
||||
) => Promise<AxiosResponse<pond.UpdateFieldResponse>>;
|
||||
}
|
||||
|
||||
export const FieldAPIContext = createContext<IFieldAPIContext>({} as IFieldAPIContext);
|
||||
|
|
@ -80,6 +88,30 @@ export default function FieldProvider(props: PropsWithChildren<Props>) {
|
|||
);
|
||||
};
|
||||
|
||||
const fieldsPageData = (
|
||||
limit: number,
|
||||
offset: number,
|
||||
order?: "asc" | "desc",
|
||||
orderBy?: string,
|
||||
search?: string,
|
||||
otherTeam?: string,
|
||||
) => {
|
||||
const view = otherTeam ? otherTeam : as
|
||||
return get<pond.ListFieldsPageDataResponse>(
|
||||
pondURL(
|
||||
"/fieldsPage" +
|
||||
"?limit=" +
|
||||
limit +
|
||||
"&offset=" +
|
||||
offset +
|
||||
("&order=" + or(order, "asc")) +
|
||||
("&by=" + or(orderBy, "key")) +
|
||||
(view ? "&as=" + view : "") +
|
||||
(search ? "&search=" + search : "")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const updateField = (key: string, field: pond.FieldSettings, asRoot?: boolean, otherTeam?: string) => {
|
||||
const view = otherTeam ? otherTeam : as
|
||||
if (view)
|
||||
|
|
@ -100,7 +132,8 @@ export default function FieldProvider(props: PropsWithChildren<Props>) {
|
|||
getField,
|
||||
listFields,
|
||||
removeField,
|
||||
updateField
|
||||
updateField,
|
||||
fieldsPageData
|
||||
}}>
|
||||
{children}
|
||||
</FieldAPIContext.Provider>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue