UNPKG

870 BJavaScriptView Raw
1const { SquidexClientManager } = require('squidex-client-manager');
2require('dotenv').config();
3
4const main = async () => {
5 const clientSecret = process.env.SQUIDEX_CLIENT_SECRET;
6 const clientId = process.env.SQUIDEX_CLIENT_ID;
7 const url = process.env.SQUIDEX_CONNECT_URL;
8 const appName = process.env.APP_NAME;
9
10 const client = new SquidexClientManager(url, appName, clientId, clientSecret);
11 // Get our record data
12 const record = await client.RecordAsync('Articles', {
13 id: '4bb3a7bb-962d-4183-9ca6-35d170c34f3b',
14 });
15
16 // Change the relevant fields
17 record.title.iv = 'the title is updated';
18 record.text.iv = 'the article text updated';
19
20 // Send the update
21 const update = await client.UpdateAsync('Articles', {
22 id: '4bb3a7bb-962d-4183-9ca6-35d170c34f3b',
23 data: record,
24 });
25 console.log(JSON.stringify(update, null, 2));
26};
27
28main();