How to use ts-odata-client - 1 common examples

To help you get started, we’ve selected a few ts-odata-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github steedos / object-server / packages / react-components / src / datasource / index.ts View on Github external
let skip = currentPage * pageSize

    let spaceId = utils.getCookie("X-Space-Id");
    let authToken = utils.getCookie("X-Auth-Token");
    let userId = utils.getCookie("X-User-Id")
    
    const endpoint = `${service}/api/odata/v4/${spaceId}/${objectName}`;
    const requestInit = ()=>{
        return {
            headers: {
                'X-Auth-Token': authToken,
                'X-User-Id': userId
            }
        }
    }
    const baseQuery = Odata.ODataV4QueryProvider.createQuery(endpoint, requestInit);
    let query = baseQuery.skip(skip || 0)

    if(pageSize){
        query = query.top(pageSize)
    }

    if($select){
        query = query.select(...$select)
    }
    if(options.filters){
        options.filters.forEach((element: any) => {
            query = query.filter((p: any) => p[element.operation](element.columnName, element.value));
        });
    }
    let results = await query.getManyAsync();
    return results

ts-odata-client

OData TypeScript Client

ISC
Latest version published 11 months ago

Package Health Score

53 / 100
Full package analysis

Popular ts-odata-client functions