Skip to content

🐛 Bug: Patch API for fields with select options #10109

@dstala

Description

@dstala

Please confirm that the bug report does not already exist

  • I confirm there is no existing issue for this bug.

Steps to reproduce

msg: "Cannot read properties of undefined (reading 'replace')"

let axios = require("axios").default;

let tokenX = 'eSzQgYbkJaXEm4-pJRP-8Mwsi3dBuBtxFlah8BPe';
let projectId = 'pfo80tyd5rpckyu'
let route = 'http://localhost:8080';
let columnId = 'c7sxtwr1s1g6i9g';

let fieldUpdate = {
    method: 'PATCH',
    url: `${route}/api/v2/meta/columns/${columnId}`,
    headers: {
        'xc-token': tokenX
    },
    data: {
        colOptions: {
            options: [
                {title: "modifiedOption1"},
                {title: "modifiedOption2"}
            ]
        }
    }
};
async function nc_axios(options, token, data, cookie) {
    if(token) {
        options.headers = {'xc-token': token}
    }
    if(data) {
        options.data = data;
    }

    if(cookie) {
        options.headers = {'xc-token': token, 'withCredentials': true}
    }

    try {
        let response = await axios.request(options);
        console.log(JSON.stringify(response.data, null, 2));
        return response;
    } catch (error) {
        console.error(error);
        return error;
    }
}


(async () => {

    // standard columns
    let tableMeta = await nc_axios(fieldUpdate, tokenX);
    console.log(tableMeta.data);

})().catch(err => {
    console.log(err);
});

Desired Behavior

Update options

Project Details

258.10

Attachments

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions