JSFiddle - React, Tailwind, and code Playground

by NesterOne

HTML

<script src="https://apis.google.com/js/client.js"></script>

JavaScript

// This sample assumes a client object has been created.
// To learn more about creating a client, check out the starter:
//  https://developers.google.com/+/quickstart/javascript
// This example shows how to create a moment that is associated with a URL that
// has schema.org markup.
function writeAddActivity(url){
    var payload = {
      "type":"http:\/\/schemas.google.com\/AddActivity",
      "startDate": "2012-10-31T23:59:59.999Z"
    };
    if (url != undefined){
      payload.target = {
        'url' : url
      };
    }else{
    payload.target = {
      "id" : "replacewithuniqueidforaddtarget",
      "image" : "http:\/\/www.google.com\/s2\/static\/images\/GoogleyEyes.png",
      "type" : "http:\/\/schema.org\/CreativeWork",
      "description" : "The description for the activity",
      "name":"An example of AddActivity"
    };
  }
  gapi.client.plus.moments.insert(
      {  'userId' : 'me',
         'collection' : 'vault',
         'resource' : payload
      }).execute(function(result){
          console.log(result);
      });
}