1
00:00:08,010 --> 00:00:08,810
Hey everybody.

2
00:00:08,810 --> 00:00:09,560
Welcome back.

3
00:00:09,550 --> 00:00:15,320
Joining me here with slopestyle common in this lesson we are completing the third stage of creating

4
00:00:15,320 --> 00:00:16,170
a user.

5
00:00:16,220 --> 00:00:22,250
We've already done the register user logging user where we get the token and now we're going to be using

6
00:00:22,250 --> 00:00:27,790
that token to do the third stage which is to actually create the user.

7
00:00:27,830 --> 00:00:28,540
OK.

8
00:00:28,940 --> 00:00:34,130
So to get started let's go ahead and check out postman and see what we're going to be working with.

9
00:00:34,130 --> 00:00:37,710
All right so first off if we look in headers we have something new.

10
00:00:37,910 --> 00:00:39,590
We have an authorization header.

11
00:00:39,620 --> 00:00:40,120
OK.

12
00:00:40,280 --> 00:00:48,980
So this is a this is where we include the token inside the header of our TTP request because this particular

13
00:00:49,490 --> 00:00:55,670
route which is what they're called in the API the endpoint user slash add is locked down meaning that

14
00:00:55,700 --> 00:01:04,490
unless this HTP request has an authorization header with a valid token it won't get through the it won't

15
00:01:04,490 --> 00:01:06,530
get through the guards that are on the API.

16
00:01:06,610 --> 00:01:11,110
It will kick it back with an unauthorized unauthorized request.

17
00:01:11,170 --> 00:01:11,730
OK.

18
00:01:12,020 --> 00:01:16,110
So that's the first thing that's different now that we're going to need to account for in X code.

19
00:01:16,380 --> 00:01:19,530
And the next thing is that our body is a little bit bigger.

20
00:01:19,680 --> 00:01:25,690
So we have a name so there's the user name of the users that is displayed next to in there and the messages

21
00:01:25,700 --> 00:01:30,830
in the chat window and we have the e-mail we are passing an avatar name.

22
00:01:30,830 --> 00:01:36,760
So this corresponds to the type of Avatar asset that they have selected.

23
00:01:36,920 --> 00:01:42,950
And then the Avatar color which right here is just a string called Text value doesn't really matter.

24
00:01:42,950 --> 00:01:49,030
But that's going to be that's going to represent the R.G. values that are randomly generated.

25
00:01:49,030 --> 00:01:51,700
Once we get to that point here in several lessons.

26
00:01:51,710 --> 00:01:51,950
All right.

27
00:01:51,960 --> 00:01:56,930
So the the the four things that we're going to need to worry about name email avatar name and Avatar

28
00:01:56,930 --> 00:01:57,610
color.

29
00:01:57,620 --> 00:01:59,680
That's what we are passing as a body.

30
00:01:59,960 --> 00:02:09,610
And so if we go ahead and send this we are also receiving a chase on data and the data that we're going

31
00:02:09,610 --> 00:02:13,120
to be interested in getting is the avatar color name email and name.

32
00:02:13,360 --> 00:02:15,760
But also this guy right here the ID.

33
00:02:15,850 --> 00:02:16,360
All right.

34
00:02:16,570 --> 00:02:22,120
So we're going to need to take all that in stride we're gonna need to pass a body we're going to need

35
00:02:22,120 --> 00:02:24,560
to receive some data.

36
00:02:24,670 --> 00:02:29,290
And so we need some way to save all of this information for the user.

37
00:02:29,290 --> 00:02:35,290
So I'm thinking we create another service and we're going to call that the user data service.

38
00:02:35,290 --> 00:02:35,840
OK.

39
00:02:36,130 --> 00:02:38,290
So it's just going to be a swift file.

40
00:02:38,320 --> 00:02:51,100
I call this user data service and I save that and this is going to be a class called user data service

41
00:02:51,710 --> 00:02:54,820
and it's going to be a singleton like our other office service.

42
00:02:54,820 --> 00:03:04,630
We're going to say static that instance equal to user data service and then we're going to have in here

43
00:03:04,720 --> 00:03:07,240
the variables that we that we see here in Postman.

44
00:03:07,240 --> 00:03:09,370
So these five right here.

45
00:03:09,370 --> 00:03:20,710
And so we're going to say public private set var ID is equal to an empty string.

46
00:03:20,920 --> 00:03:25,900
And so before we move on this out and talk about this Requip what we're saying is we're going to create

47
00:03:25,930 --> 00:03:28,200
a public Geter variable.

48
00:03:28,240 --> 00:03:36,940
So it's public in that other classes can read it but other classes aren't allowed to set this variable

49
00:03:36,940 --> 00:03:37,570
directly.

50
00:03:37,570 --> 00:03:39,770
That's what this part here means private set.

51
00:03:39,820 --> 00:03:46,480
So other classes are welcome to look at it and see it but only this file is able to directly modify

52
00:03:46,480 --> 00:03:49,510
the value that ID is set to.

53
00:03:49,560 --> 00:03:50,380
OK.

54
00:03:51,010 --> 00:03:58,450
And that's just being a little programmers and encapsulating our data and protecting it from being unwontedly

55
00:03:58,510 --> 00:04:00,420
changed by their classes.

56
00:04:00,430 --> 00:04:00,760
Right.

57
00:04:01,030 --> 00:04:07,960
So now we're going to say public private said.

58
00:04:08,250 --> 00:04:14,690
And that's going to be Avatar color and we're going to initialize that to an empty string.

59
00:04:14,730 --> 00:04:18,680
I'm just going to copy and paste this a few more times.

60
00:04:19,060 --> 00:04:24,640
So then we also have a tar name.

61
00:04:24,680 --> 00:04:34,070
This one here is e-mail and this one here has a name that should cover all five of these that we can

62
00:04:34,070 --> 00:04:38,450
expect to receive as a response from this API endpoint.

63
00:04:38,840 --> 00:04:39,260
All right.

64
00:04:39,350 --> 00:04:46,820
That's good but now we need a way to set these right because we made these private sets.

65
00:04:46,820 --> 00:04:55,190
So we're going to create a nice little function here and call the set user data service.

66
00:04:55,220 --> 00:05:00,620
And let's just call it user data and we are going to need to pass into it because what we're going to

67
00:05:00,620 --> 00:05:06,530
do is we're going to create an office service homophile request here in the service and then we're going

68
00:05:06,530 --> 00:05:12,320
to parse out the data that we receive and then we are going to set the user data service properties

69
00:05:13,130 --> 00:05:14,090
to those values.

70
00:05:14,090 --> 00:05:14,520
Okay.

71
00:05:14,660 --> 00:05:19,990
So we need a function that we can call from other classes that will actually do the setting here.

72
00:05:20,140 --> 00:05:23,270
So you can see Heidi this is going to be a string.

73
00:05:23,290 --> 00:05:28,700
When we say avatar actually this is color.

74
00:05:29,400 --> 00:05:31,000
And that's a string.

75
00:05:31,100 --> 00:05:37,770
We got the tar name and that's a string.

76
00:05:37,840 --> 00:05:40,600
We've got e-mail and that's a string.

77
00:05:40,870 --> 00:05:43,850
And then we have a name and a string.

78
00:05:44,300 --> 00:05:50,720
So we're just setting up all of the variables that we're going to need to pass into this function so

79
00:05:50,720 --> 00:05:52,530
that we can set these guys right here.

80
00:05:52,570 --> 00:05:52,990
OK.

81
00:05:53,240 --> 00:06:00,590
So once we have this and we just close this bottom pane going to see a self-taught ID is equal to the

82
00:06:00,860 --> 00:06:03,120
ID that has passed into this function.

83
00:06:03,280 --> 00:06:09,460
Self-taught Avatar color is equal to the color that is passed into this function.

84
00:06:09,560 --> 00:06:17,830
Self-taught this avatar name is equal to the avatar name that is passed into this function.

85
00:06:17,890 --> 00:06:25,790
Sulphite email is here to the email that is passed into this function and self that name is equal to

86
00:06:25,880 --> 00:06:28,860
the name that is Peston to this function.

87
00:06:29,270 --> 00:06:30,230
All right.

88
00:06:30,620 --> 00:06:33,210
So that is are you a data service.

89
00:06:33,380 --> 00:06:37,370
And just because I have the advantage of having done this before I also know that we are going to need

90
00:06:37,430 --> 00:06:41,330
a function to update the avatar name.

91
00:06:41,530 --> 00:06:51,560
We'll just call that set have a tar name and we'll pass in an avatar name of type string.

92
00:06:52,280 --> 00:07:00,830
And with that we are going to say self-taught avatar name is equal to the avatar name that is passed

93
00:07:00,890 --> 00:07:01,590
into it.

94
00:07:01,800 --> 00:07:02,280
All right.

95
00:07:02,330 --> 00:07:04,690
So just something that we're going to use later on.

96
00:07:04,850 --> 00:07:05,380
All right.

97
00:07:05,570 --> 00:07:15,300
So let's go ahead and then jump into our service starts with the file and actually code up this add

98
00:07:15,410 --> 00:07:17,020
user function.

99
00:07:17,120 --> 00:07:26,840
So we are going to call it phunk create user and we are going to be calling this from the create account

100
00:07:28,540 --> 00:07:29,070
screen.

101
00:07:29,090 --> 00:07:36,740
So we are going to need to pass in to this function several variables we need to get the name are going

102
00:07:36,740 --> 00:07:40,400
to need the email which is a string.

103
00:07:40,400 --> 00:07:47,590
We're going to need the avatar name which is a string.

104
00:07:47,590 --> 00:07:51,290
We're going to need to close this right hand pane over here.

105
00:07:51,330 --> 00:07:56,580
We're going to need to know the Avatar color which is also a string.

106
00:07:56,870 --> 00:08:06,670
And then we are going to need our completion handler like usual put in our it's keeping and completion

107
00:08:08,340 --> 00:08:10,940
handler that we are ready.

108
00:08:11,300 --> 00:08:18,860
So like usual we're just going to lower case our e-mail that lower case I'm just going to copy from

109
00:08:18,860 --> 00:08:19,980
up here actually.

110
00:08:21,650 --> 00:08:22,070
Or go

111
00:08:25,210 --> 00:08:28,740
and then we're going to need a body to want to copy this one here.

112
00:08:31,330 --> 00:08:33,130
This body's a little bit longer.

113
00:08:33,130 --> 00:08:37,840
All right let's go ahead and run back to postman and show you what we need we need name email avatar

114
00:08:37,840 --> 00:08:39,850
name and Avatar color.

115
00:08:39,870 --> 00:08:47,800
All right so we have Connect cut that right here.

116
00:08:47,810 --> 00:08:49,740
Change it to name.

117
00:08:49,850 --> 00:08:55,140
And this is going to be name email is the lowercase imho.

118
00:08:55,640 --> 00:09:09,610
We're going to need avatar name and that's going to be the avatar name then of our color.

119
00:09:09,740 --> 00:09:15,140
And that is a tar color and I'm just going to double check.

120
00:09:15,140 --> 00:09:22,130
These all match up name email name email that make sure that the spelling is correct avatar name Avatar

121
00:09:22,490 --> 00:09:25,030
color avatar name Avatar color.

122
00:09:25,130 --> 00:09:25,520
All right.

123
00:09:25,610 --> 00:09:28,780
So the body looks good.

124
00:09:28,830 --> 00:09:30,600
Oh I need a comma here.

125
00:09:30,600 --> 00:09:31,190
There you go.

126
00:09:32,340 --> 00:09:34,290
Next up we need a header.

127
00:09:34,500 --> 00:09:39,320
And remember and like we were just looking in postman this time or header's a little bit different.

128
00:09:39,330 --> 00:09:45,510
We have an extra key value pair with the authorization header and the bearer token.

129
00:09:45,660 --> 00:09:48,660
OK so easy enough.

130
00:09:48,660 --> 00:10:01,140
We've already created a barrier or a header before so let's just say that header is equal to and this

131
00:10:01,140 --> 00:10:05,820
time the key is called authorization.

132
00:10:05,890 --> 00:10:07,190
It's built that very wrong.

133
00:10:07,200 --> 00:10:10,110
Author is zation.

134
00:10:10,210 --> 00:10:10,870
All right.

135
00:10:11,010 --> 00:10:16,800
And the value is capital bear B.A. rdr.

136
00:10:16,850 --> 00:10:21,480
And then you have to have a space and then what comes after that is the token.

137
00:10:21,480 --> 00:10:30,590
So we're going to do some string interpolation and say off service dot instance dot off token.

138
00:10:30,870 --> 00:10:31,390
OK.

139
00:10:31,830 --> 00:10:38,790
And then we have still our other one which is the content.

140
00:10:39,220 --> 00:10:45,080
You know what I'm going to copy this from the constants because it's kind of a pain to write out here.

141
00:10:46,570 --> 00:10:48,180
You get that.

142
00:10:48,400 --> 00:10:50,100
And there you go.

143
00:10:50,110 --> 00:10:53,580
There is our second key value pair.

144
00:10:53,710 --> 00:10:59,770
So now this header with the authorization and the content type looks just like the one that we have

145
00:10:59,770 --> 00:11:00,610
here.

146
00:11:01,210 --> 00:11:02,890
So perfect.

147
00:11:02,890 --> 00:11:05,240
All right so now we have our body we have our header.

148
00:11:05,260 --> 00:11:09,760
Let's go ahead and craft our album of our request.

149
00:11:10,270 --> 00:11:16,030
All right so we're you are going to say Elmo year your request and pick this guy here that we've been

150
00:11:16,030 --> 00:11:22,000
using with all of our fancy upgrade options that we can use just like getting the car with all of the

151
00:11:22,000 --> 00:11:23,240
options.

152
00:11:23,270 --> 00:11:24,840
I said this is a fancy web request.

153
00:11:24,880 --> 00:11:27,580
We're going to say OK we haven't created the euro yet.

154
00:11:27,650 --> 00:11:30,800
So is jump over to Constance do you.

155
00:11:30,840 --> 00:11:33,220
Are you at Constance.

156
00:11:33,270 --> 00:11:33,510
All right.

157
00:11:33,510 --> 00:11:41,880
So this is going to be called Let your owl user underscore add.

158
00:11:42,180 --> 00:11:46,610
And this is going to be similar to our other ones.

159
00:11:47,250 --> 00:11:53,890
But instead of a log in it's user slash add.

160
00:11:53,930 --> 00:11:54,480
All right.

161
00:11:54,540 --> 00:11:56,990
So that's good going to say that.

162
00:11:57,030 --> 00:12:04,630
Kufi this constant jump back into service and paste that right here for the euro.

163
00:12:04,830 --> 00:12:09,440
And then the method is still dot post I believe Let's double check that.

164
00:12:09,590 --> 00:12:24,360
Post the parameters is body encoding is Jason in Kooning default headers is header and the response

165
00:12:24,360 --> 00:12:31,530
type is response Jason because we want the response that the HTP request we turn to us in the form of

166
00:12:31,700 --> 00:12:35,790
g on and then I press return on the completion on the closure.

167
00:12:35,940 --> 00:12:44,460
And I want to rename that to be response and get rid of this code placeholder and then like we've been

168
00:12:44,460 --> 00:12:49,350
doing we're going to say if responsa dot result.

169
00:12:49,540 --> 00:12:52,120
Nope nope no response out result.

170
00:12:52,160 --> 00:12:56,120
Dot error is nil.

171
00:12:56,830 --> 00:12:59,500
Then we're going to do some stuff else.

172
00:12:59,770 --> 00:13:05,280
We're going to see completion is false and we are going to debug.

173
00:13:05,300 --> 00:13:14,490
Print the errors or response stories salt error as any can there we.

174
00:13:15,100 --> 00:13:17,330
But if it is successful what are we going to do.

175
00:13:17,340 --> 00:13:25,910
We are going to get our response Giese on right here and we're going to parse it out and said it said

176
00:13:25,960 --> 00:13:31,000
those properties equal to the properties the corresponding properties in our user data service that

177
00:13:31,000 --> 00:13:32,390
we just created.

178
00:13:32,520 --> 00:13:33,330
All right.

179
00:13:33,820 --> 00:13:41,440
So let's let's go ahead and do that just like we did with our register or are logging user we are going

180
00:13:41,440 --> 00:13:43,900
to get back some data.

181
00:13:43,900 --> 00:13:48,350
We're going to turn that data into a chase object and then parse it out from from there.

182
00:13:48,580 --> 00:13:54,960
So I'm going to say guard Hulet and chase on equal.

183
00:13:55,530 --> 00:13:55,900
Sorry.

184
00:13:55,930 --> 00:14:05,980
We're going to say guard data equal response that data helps return.

185
00:14:06,590 --> 00:14:11,800
Then with that data we're going to create a J some object using Swiftie chastens we can say that just

186
00:14:11,800 --> 00:14:19,810
aren't equal Jaison that we're going to do an initialiser and I wish you would show up here.

187
00:14:19,810 --> 00:14:21,650
All right here's just one data.

188
00:14:21,790 --> 00:14:25,370
You know and the data that we want his rate data.

189
00:14:25,390 --> 00:14:33,520
All right so now all we've got to do is create some variables that we can then pass into our function

190
00:14:33,520 --> 00:14:34,760
that we created here.

191
00:14:34,790 --> 00:14:36,170
So user data.

192
00:14:36,190 --> 00:14:36,530
All right.

193
00:14:36,580 --> 00:14:45,430
So we're going to say let the equal Jason know we're going to drill into the juice on and find it by

194
00:14:45,430 --> 00:14:56,980
its key which is underscore ID as you can see here in post man underscore ID is its key and we're going

195
00:14:56,980 --> 00:14:58,920
to see a string value.

196
00:14:58,930 --> 00:15:04,830
So we going to unwrap that and if it doesn't exist it's not going to crash because 50 handles that force

197
00:15:04,860 --> 00:15:09,510
all is going to do his set id equal to an empty string which is just fine for us.

198
00:15:09,580 --> 00:15:20,950
So then we're going to say let color equal J song and that key is Avatar color or you say that string

199
00:15:20,950 --> 00:15:21,950
value.

200
00:15:22,090 --> 00:15:32,220
Now we're going to say let's have a tar name equal to a song that is going to be you have a higher name

201
00:15:33,340 --> 00:15:41,630
string value than the email we're going to see that you know people song and it's key is called e-mail

202
00:15:42,460 --> 00:15:49,620
top string value and they're going to say let name equal sun.

203
00:15:49,660 --> 00:15:55,800
It's key his name string value.

204
00:15:56,110 --> 00:16:01,840
So there are the five variables that we want that come as a response.

205
00:16:01,870 --> 00:16:07,310
In this if I call then what are we going to do with these real we're going to call user data service

206
00:16:07,310 --> 00:16:11,680
dot instance and does set user data id..

207
00:16:12,100 --> 00:16:24,190
And we're going to pass in those that we just created so Id color the avatar name.

208
00:16:24,640 --> 00:16:38,570
Come on e-mail and I want to build that and then say completion is true.

209
00:16:40,070 --> 00:16:43,340
Say that and let's see if these errors go away here.

210
00:16:43,450 --> 00:16:43,690
All right.

211
00:16:43,710 --> 00:16:44,180
Yeah.

212
00:16:44,240 --> 00:16:45,680
So these errors went away.

213
00:16:45,930 --> 00:16:53,760
And yeah that's that's the that's the whole create user function.

214
00:16:53,760 --> 00:16:56,850
So just to run over one more time what is happening.

215
00:16:56,850 --> 00:17:05,100
We are calling a create user function that will be called in our create account VC we are passing into

216
00:17:05,100 --> 00:17:09,560
that function and name email avatar name and Avatar color.

217
00:17:09,570 --> 00:17:17,460
We have a body that is being sent in this age TTP request we have a header that is also being sent with

218
00:17:17,460 --> 00:17:23,460
the HTP request but this time we have an authorization header so that's kind of new and exciting.

219
00:17:24,030 --> 00:17:26,480
Then we have then we're creating the request here.

220
00:17:26,520 --> 00:17:32,130
We are sending it to a specific you or L that we that we know.

221
00:17:32,160 --> 00:17:32,830
It's a post.

222
00:17:32,850 --> 00:17:38,850
We're sending the body and the headers and we're getting response we're getting J song as a response

223
00:17:39,210 --> 00:17:45,930
and then we are parsing out the response and setting those values equal to their corresponding properties

224
00:17:45,960 --> 00:17:51,450
in our user data service which we can then use throughout the rest of the app.

225
00:17:51,750 --> 00:17:54,730
I saw some pretty cool stuff.

226
00:17:54,990 --> 00:17:56,660
So you know let's see if it works.

227
00:17:56,850 --> 00:18:05,160
We're going to have to jump into our create a PC now and instead of printing out this what we are going

228
00:18:05,160 --> 00:18:10,250
to do is call a service instance does it create user.

229
00:18:10,530 --> 00:18:13,390
And we are going to we haven't gotten the name yet.

230
00:18:13,390 --> 00:18:18,210
Actually that's you know that's that's from this guy right here.

231
00:18:18,270 --> 00:18:22,130
So we're just going to do the same thing that we did here.

232
00:18:22,210 --> 00:18:30,710
So I'm going to say God let nothing equal this is going to be user name user name.

233
00:18:31,140 --> 00:18:35,740
Text that text and username text that text.

234
00:18:35,740 --> 00:18:38,560
All right so now we have a name variables.

235
00:18:39,270 --> 00:18:40,520
Just pop that in right here.

236
00:18:40,530 --> 00:18:44,110
Name e-mail we still hearty had.

237
00:18:44,370 --> 00:18:48,210
And then here we need a couple of variables.

238
00:18:48,210 --> 00:18:48,860
All right.

239
00:18:49,130 --> 00:18:53,240
We're going to keep track of the avatar name and color.

240
00:18:53,240 --> 00:18:59,020
All right so right now for now we're just going to create a couple of variables default variables.

241
00:18:59,040 --> 00:19:06,750
So we're going to be able to give the user the option to select a avatar image and an avatar background

242
00:19:06,750 --> 00:19:07,500
color.

243
00:19:07,680 --> 00:19:13,640
If they don't choose to then we're going to have a supplied default image right.

244
00:19:13,700 --> 00:19:13,930
Right.

245
00:19:13,980 --> 00:19:22,500
So that's going to be called her name and the default is just profile default.

246
00:19:22,500 --> 00:19:25,690
And that's actually if you go look at your assets.

247
00:19:25,890 --> 00:19:29,470
That's the name of this guy right here.

248
00:19:29,820 --> 00:19:32,240
So that's our default profile image.

249
00:19:32,250 --> 00:19:35,220
If the user does not pick one for themselves.

250
00:19:35,220 --> 00:19:43,670
All right so with that created we can set that here for the avatar name avatar name.

251
00:19:43,920 --> 00:19:49,630
And then we need also a default avatar color.

252
00:19:50,220 --> 00:19:57,300
And this is going to look a little bit strange to you right now perhaps but what this is is it's a string

253
00:19:57,310 --> 00:20:02,790
array of the red green blue Alpha properties of a color.

254
00:20:02,830 --> 00:20:03,400
All right.

255
00:20:03,750 --> 00:20:13,620
So the default we're just going to put 0.5 zero point five 0.5 and 1 and this just gives a default like

256
00:20:13,710 --> 00:20:14,440
great color.

257
00:20:14,490 --> 00:20:15,090
OK.

258
00:20:15,360 --> 00:20:17,780
And we'll talk more about this here in a bit.

259
00:20:17,790 --> 00:20:22,250
And what how this how this is handled later on OK.

260
00:20:22,440 --> 00:20:29,310
But for now we can put in the avatar name and the have a tar color just so that we have values to put

261
00:20:29,310 --> 00:20:29,930
in there.

262
00:20:30,150 --> 00:20:35,490
And then for our completion handler going to press return here for the bhool I'm going to rename it

263
00:20:35,490 --> 00:20:46,620
to success and then the code just going to get rid of that and we're going to say if success is a problem

264
00:20:46,620 --> 00:20:55,660
here we need self because we are in a closure is when we say self name and self that Avatar color that

265
00:20:55,730 --> 00:20:57,110
we go that's you get rid of that error.

266
00:20:57,240 --> 00:21:00,780
And if success what can we do.

267
00:21:00,780 --> 00:21:05,150
Well this is this is the end of this is the end of the of the three stages.

268
00:21:05,160 --> 00:21:13,590
So at this point what we want to do is say self-taught perform segue with identifier unwind because

269
00:21:13,590 --> 00:21:18,660
we have gone through the three stages we've registered a user logged it in and created that user.

270
00:21:18,810 --> 00:21:27,960
So at that point we would dismiss the create account view and then go through the process of updating

271
00:21:28,350 --> 00:21:34,630
the UI up pulling down the channels updating the chat DC and all of that kind of stuff.

272
00:21:35,040 --> 00:21:41,380
But for now we're going to be doing is just dismissing it and let's go ahead and let's print some stuff

273
00:21:41,390 --> 00:21:47,840
just to also make sure that we're saving correctly to our humanity to service this printout and user

274
00:21:47,840 --> 00:21:50,540
data service for instance.

275
00:21:51,770 --> 00:22:00,500
Let's say name and then user data service that instance dot avatar name as well.

276
00:22:00,500 --> 00:22:03,670
All right so are we going to see this and run it.

277
00:22:03,680 --> 00:22:05,290
And I think I think that should be it.

278
00:22:05,300 --> 00:22:09,150
I don't think we're forgetting anything.

279
00:22:09,150 --> 00:22:10,730
All right so here we go.

280
00:22:10,840 --> 00:22:15,090
The big test in I don't have an account sign up now.

281
00:22:15,170 --> 00:22:21,760
All right so here we go and give this name going to call this Johnny adds user.

282
00:22:21,980 --> 00:22:23,140
What a cool name.

283
00:22:23,390 --> 00:22:23,910
All right.

284
00:22:23,940 --> 00:22:30,970
E-mail is with x x dot com password is 1 2 3 4 5 6.

285
00:22:30,980 --> 00:22:32,840
So here we go.

286
00:22:32,840 --> 00:22:38,660
When I create this account just to when I click on this just run through one more time.

287
00:22:38,660 --> 00:22:40,310
We are sending

288
00:22:42,980 --> 00:22:50,090
this username this e-mail and this password into this function right here to count preste which then

289
00:22:50,090 --> 00:22:54,740
goes through the three faces that we created the register the user logging the user and this latest

290
00:22:54,740 --> 00:22:56,090
one to create user.

291
00:22:56,290 --> 00:22:56,510
All right.

292
00:22:56,510 --> 00:23:01,380
At which point it should dismiss and print out a couple of things.

293
00:23:04,760 --> 00:23:07,270
All right there we go.

294
00:23:07,290 --> 00:23:13,590
So we printed out the instance name and the avatar name.

295
00:23:13,620 --> 00:23:15,780
I actually don't see the avatar name here.

296
00:23:15,780 --> 00:23:23,660
Let's see here solve the avatar name profound default.

297
00:23:23,710 --> 00:23:25,020
That's interesting.

298
00:23:25,060 --> 00:23:30,640
Go ahead and check out over here in our office service.

299
00:23:31,090 --> 00:23:32,200
OK.

300
00:23:32,300 --> 00:23:38,450
Ah I missed this even though I thought I was double checking avatar name so.

301
00:23:38,470 --> 00:23:45,810
But you see the value of the string value instead of instead of crashing.

302
00:23:45,820 --> 00:23:47,620
All it did was return an empty string.

303
00:23:47,620 --> 00:23:50,120
Even though this did not exist.

304
00:23:50,350 --> 00:23:53,300
All right well what it was before it in A and E did not exist.

305
00:23:53,350 --> 00:23:55,540
So let's try that one more time.

306
00:23:55,540 --> 00:23:59,870
You guys probably saw that and were like I was going to crash Johnny.

307
00:24:00,010 --> 00:24:00,980
All right let's do this.

308
00:24:01,310 --> 00:24:04,570
LOG IN don't have an account.

309
00:24:05,280 --> 00:24:11,030
Journey testen to e-mail.

310
00:24:11,450 --> 00:24:14,110
Y y dot com.

311
00:24:14,110 --> 00:24:15,650
One two three four five six.

312
00:24:15,730 --> 00:24:17,170
And here we go.

313
00:24:22,170 --> 00:24:24,100
That we go to business.

314
00:24:24,100 --> 00:24:27,510
We have our user name and our avatar name.

315
00:24:27,550 --> 00:24:32,450
Let's go and check out the Safari lab.

316
00:24:32,800 --> 00:24:36,980
And let's go ahead and go back to our database.

317
00:24:37,100 --> 00:24:37,820
Had.

318
00:24:38,950 --> 00:24:41,530
And now it is the first time you're doing it.

319
00:24:41,680 --> 00:24:45,150
You should have for the first time some users right here.

320
00:24:45,150 --> 00:24:48,610
All right so let's go ahead and check this out.

321
00:24:48,610 --> 00:24:49,380
There it is.

322
00:24:49,390 --> 00:25:00,250
Johnny testing to so I say guys we are through the process of creating a new user.

323
00:25:00,310 --> 00:25:07,180
We have registered users we have logged in users at which point we get the off token which allows us

324
00:25:07,180 --> 00:25:13,780
to access all of the other locked down routes that the API provides.

325
00:25:13,780 --> 00:25:21,510
We created ourselves a nice user data service so that we can use these properties elsewhere in the app.

326
00:25:21,590 --> 00:25:30,820
And yeah I mean we're getting very close to being able to start sending messages adding channels seeing

327
00:25:31,000 --> 00:25:32,490
chats from other people.

328
00:25:32,500 --> 00:25:35,890
So you guys are really enjoying this and have fun.

329
00:25:35,890 --> 00:25:37,520
I know that I am.

330
00:25:37,540 --> 00:25:41,460
So before we sign off I'm just going to go ahead and add our progress.

331
00:25:41,470 --> 00:25:50,090
I mean to say get ad start get commit dash em and this is less than 12.

332
00:25:51,190 --> 00:26:00,930
And I'm going to push this push origin less and dash to.

333
00:26:01,060 --> 00:26:01,410
All right.

334
00:26:01,440 --> 00:26:04,080
We'll see you all in the next one.
