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