So let's take care of writing some of the JavaScript we're going to need to authenticate and I'm looking
at the login page HTML file that we were working on the last time around.
What I'm going to do now is just to save some time, open the strike, just partial.
So I'll open that because in this valve function, all of this, the form validation, partial copy,
everything, including the statement, and then we'll get rid of the Fed statement or modify the statement
after the fact.
It'll just take some time.
So I'm back in login page gulledge HTML and I'll paste the contents that I just copied from stroke,
just partial into the valve function here at the bottom of this file.
So first thing I'll do is I'll get rid of all of this stuff inside the first, then I should get rid
of the couch, too.
I don't need that.
So I'll make this go from response to response, text to response, response, Jason.
OK, and we're actually not going to be able to call that yet because the route I'm about to put in
here doesn't exist.
So I'm going to have the route that the statement goes to call our apro slash API and then slash authenticate.
OK, now what am I going to put in there?
Well, there's actually a few changes to make at the top of this.
So the form is not called document yet, is not called charge form.
What can I actually call this form?
It is called charge for.
Let's call the login form.
He sat in there and come down here, so we'll get login forms, we check its validity.
So that's all fine.
We don't have a high pay button because there is no pay button.
There is no amount to charge.
So we'll get rid of that.
And instead we'll make this haloed equal to, say, email.
And password, and we'll just get the values from here from right from our form, so this becomes a
document get element ID and we called it email value and the password becomes document the ID password,
which is the lowercase p value.
OK, so the request option, stay the same, the header stay the same.
We string ify our payload and make that the body of our post request and everything else there stays
the same.
So what we'll do just to make sure this works is for now we'll say console dot log data.
A response.
I guess it is.
So we'll log that once we actually get her authenticate back and hooked up properly.
So just to test things, what we'll do next is we'll go to the back end and we'll make some changes
to that code to add a root and a handler and a couple helper functions to it because we will make our
lives easier down the road and then we'll try authenticating and just get some kind of valid response
back from the back end.
All right.
We'll get started on that in the next lecture.