<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: wkpescherine</title>
    <description>The latest articles on DEV Community by wkpescherine (@wkpescherine).</description>
    <link>https://dev.to/wkpescherine</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F713894%2F668215e4-80e5-481e-90c2-ffd9231ddefc.png</url>
      <title>DEV Community: wkpescherine</title>
      <link>https://dev.to/wkpescherine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wkpescherine"/>
    <language>en</language>
    <item>
      <title>TypeError: Cannot read properties of undefined (reading 'load')</title>
      <dc:creator>wkpescherine</dc:creator>
      <pubDate>Mon, 27 Sep 2021 00:23:45 +0000</pubDate>
      <link>https://dev.to/wkpescherine/typeerror-cannot-read-properties-of-undefined-reading-load-1pkf</link>
      <guid>https://dev.to/wkpescherine/typeerror-cannot-read-properties-of-undefined-reading-load-1pkf</guid>
      <description>&lt;p&gt;Recieivng the abiove error code. I have looked oer the Google docs and was able to get it to work on there site. But when I take there  code and put into my react app it gives me that error.&lt;/p&gt;

&lt;p&gt;CODE:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* global gapi */

import React from 'react';
import './App.css';
import {Link} from 'react-router-dom'

class CreateAccount extends React.Component {
    state = {
        username:"none",
        password:"none",
        email:"none"
    }

    acctHandleUserNameChange = event =&amp;gt;{
        this.setState({
            username: event.target.value
          })
    }

    acctHandlePasswordChange = event =&amp;gt;{
        this.setState({
            pasword: event.target.value
          })
    }

    acctEmailChange = event =&amp;gt;{
        this.setState({
            email: event.target.value
        })
    }

    makeApiCall() {
        var params = {
            spreadsheetId: 'xxxxxxxxxxxxxxxxxxxxx',
            range: 'A1:A3',
            valueInputOption: 'USER_ENABLED',
            insertDataOption: 'INSERT_ROWS', 
        };

        var valueRangeBody = {
            "values": [
                [
                  this.state.username,
                  this.state.password,
                  this.state.email
                ]
            ]          
        };

        var request = window.gapi.client.sheets.spreadsheets.values.append(params, valueRangeBody);
        request.then(function(response) {
        // TODO: Change code below to process the `response` object:
            console.log(response.result);
        }, function(reason) {
            console.error('error: ' + reason.result.error.message);
        });
    }

    initClient() {
        var API_KEY = 'xxxxxxxxxxxxx';
        var CLIENT_ID = 'xxxxxxxxxxx';  // 

        // TODO: Authorize using one of the following scopes:
        //   'https://www.googleapis.com/auth/drive'
        //   'https://www.googleapis.com/auth/drive.file'
        //   'https://www.googleapis.com/auth/spreadsheets'
        var SCOPE = 'www.googleapis.com/auth/spreadsheets';

        window.gapi.client.init({
          'apiKey': API_KEY,
          'clientId': CLIENT_ID,
          'scope': SCOPE,
          'discoveryDocs': ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
        }).then(function() {
          gapi.auth2.getAuthInstance().isSignedIn.listen(this.updateSignInStatus());
          this.updateSignInStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
        });
      }

    handleClientLoad = () =&amp;gt; {
        window.gapi.load('client:auth2', this.initClient());
      }

    updateSignInStatus(isSignedIn) {
        if (isSignedIn) {
          this.makeApiCall();
        }
      }

    handleSignInClick(event) {
        window.gapi.auth2.getAuthInstance().signIn();
      }

    handleSignOutClick(event) {
        window.gapi.auth2.getAuthInstance().signOut();
      }

    handleCreateAccount(){
        console.log("test Start");
        this.handleClientLoad();
        console.log("test end");
    }

    render(){
        return (
            &amp;lt;div&amp;gt;
                &amp;lt;p&amp;gt;
                    &amp;lt;input type="text" placeholder="Enter username" onChange={event =&amp;gt; this.acctHandleUserNameChange(event)}&amp;gt;&amp;lt;/input&amp;gt;
                &amp;lt;/p&amp;gt;

                &amp;lt;p&amp;gt;
                    &amp;lt;input type="text" placeholder="Enter password" onChange={event =&amp;gt; this.acctHandlePasswordChange(event)}&amp;gt;&amp;lt;/input&amp;gt;
                &amp;lt;/p&amp;gt;
                &amp;lt;p&amp;gt;
                    &amp;lt;input hint="email" placeholder="Enter email" type="text" onChange={event =&amp;gt; this.acctEmailChange(event)}&amp;gt;&amp;lt;/input&amp;gt;
                &amp;lt;/p&amp;gt;
                &amp;lt;p&amp;gt;
                    &amp;lt;button onClick={()=&amp;gt;this.handleCreateAccount()}&amp;gt;Create&amp;lt;/button&amp;gt;
                &amp;lt;/p&amp;gt;
                &amp;lt;p&amp;gt;
                    &amp;lt;Link to="/"&amp;gt;
                        &amp;lt;button&amp;gt;Back&amp;lt;/button&amp;gt;
                    &amp;lt;/Link&amp;gt;
                &amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
        );
    }
}

export default CreateAccount;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
