I refactored the function that works, and I still have problems
new function:
const objectRelation = async (token, typeColumnId, boardId, itemId, statusId, textValue) => {
// test
try {
const mondayClient = initMondayClient();
mondayClient.setToken(token);
const query = `query($itemId: ID, $typeColumnId: String, $statusId: String) {
items(ids: [$itemId]) {
column_values(ids: [$typeColumnId, $statusId]) {
value
}
}
}
`;
const variables = { typeColumnId, statusId, itemId };
console.log ('variables:', variables);
const response = await mondayClient.api(query, { variables });
console.log ('response:', response);
if (response.data.items[0].column_values[0].value !== null && response.data.items[0].column_values[1].value !== null) {
return response;
}
} catch (err) {
console.error(err);
}
};
with this error
023-10-24T16:28:49.761416818Z variables: {
2023-10-24T16:28:49.761499919Z typeColumnId: 'opportunity_id',
2023-10-24T16:28:49.761505919Z statusId: 'status6',
2023-10-24T16:28:49.761509419Z itemId: 5384299179
2023-10-24T16:28:49.761512519Z }
2023-10-24T16:28:49.957770970Z response: {
2023-10-24T16:28:49.957878071Z errors: [
2023-10-24T16:28:49.957882872Z {
2023-10-24T16:28:49.957886372Z message: 'Type mismatch on variable $itemId and argument ids ([ID]! / [Int])',
2023-10-24T16:28:49.957889772Z locations: [Array],
2023-10-24T16:28:49.957892972Z path: [Array],
2023-10-24T16:28:49.957896172Z extensions: [Object]
2023-10-24T16:28:49.957899572Z }
2023-10-24T16:28:49.957902872Z ],
2023-10-24T16:28:49.957905972Z account_id: 4811106
2023-10-24T16:28:49.957914572Z }