@@ -358,10 +358,10 @@ Add the following code between the `script` tags in *index.html*.
358
358
```javascript
359
359
async function get() {
360
360
361
- const id = 1 ;
361
+ const id = ' 1 ' ;
362
362
363
363
const gql = `
364
- query getById($id: Int !) {
364
+ query getById($id: ID !) {
365
365
person_by_pk(id: $id) {
366
366
id
367
367
Name
@@ -407,14 +407,15 @@ Add the following code between the `script` tags in *index.html*.
407
407
` ` ` javascript
408
408
async function update() {
409
409
410
- const id = 1 ;
410
+ const id = ' 1 ' ;
411
411
const data = {
412
+ id: id,
412
413
Name: " Molly"
413
414
};
414
415
415
416
const gql = `
416
- mutation update($id : Int ! , $item : UpdatePersonInput! ) {
417
- updatePerson(id: $id , item: $item ) {
417
+ mutation update($id : ID ! , $_partitionKeyValue : String ! , $item : UpdatePersonInput! ) {
418
+ updatePerson(id: $id , _partitionKeyValue: $_partitionKeyValue , item: $item ) {
418
419
id
419
420
Name
420
421
}
@@ -424,6 +425,7 @@ async function update() {
424
425
query: gql,
425
426
variables: {
426
427
id: id,
428
+ _partitionKeyValue: id,
427
429
item: data
428
430
}
429
431
};
@@ -464,7 +466,7 @@ Add the following code between the `script` tags in *index.html*.
464
466
async function create() {
465
467
466
468
const data = {
467
- id: "6 ",
469
+ id: "3 ",
468
470
Name: "Pedro"
469
471
};
470
472
@@ -518,19 +520,20 @@ Add the following code between the `script` tags in *index.html*.
518
520
` ` ` javascript
519
521
async function del() {
520
522
521
- const id = 3 ;
523
+ const id = ' 3 ' ;
522
524
523
525
const gql = `
524
- mutation del($id : Int ! ) {
525
- deletePerson(id: $id ) {
526
+ mutation del($id : ID ! , $_partitionKeyValue : String ! ) {
527
+ deletePerson(id: $id , _partitionKeyValue: $_partitionKeyValue ) {
526
528
id
527
529
}
528
530
}` ;
529
531
530
532
const query = {
531
533
query: gql,
532
534
variables: {
533
- id: id
535
+ id: id,
536
+ _partitionKeyValue: id
534
537
}
535
538
};
536
539
@@ -542,7 +545,7 @@ async function del() {
542
545
});
543
546
544
547
const result = await response.json ();
545
- console.log(` Record deleted: ${ result.data.deletePerson.Id } ` );
548
+ console.log(` Record deleted: ${ JSON.stringify( result.data) } ` );
546
549
}
547
550
` ` `
548
551
0 commit comments