1
00:00:02,130 --> 00:00:05,230
Now let's make sure the other route now also works.

2
00:00:05,250 --> 00:00:12,820
My goal is that users now actually get a link here which does not include all this information but just

3
00:00:12,820 --> 00:00:18,760
the ID which we generate on the server and then we output this link here with the ID and when we

4
00:00:18,760 --> 00:00:22,520
click the link or when we use the link, we reach that other route

5
00:00:22,540 --> 00:00:26,130
we defined here, this get route to then load this data for the ID.

6
00:00:26,410 --> 00:00:28,260
Now two things we need to do for that,

7
00:00:28,270 --> 00:00:33,870
for one we should send back the ID to the client so that on the client, we can encode it in the URL.

8
00:00:33,880 --> 00:00:40,630
So here I'll generate my ID here and store it in a constant and then refer to this ID constant here

9
00:00:41,050 --> 00:00:47,490
and also send it back, maybe in a location or log ID field here in our response,

10
00:00:47,500 --> 00:00:48,310
that's important

11
00:00:48,490 --> 00:00:53,290
otherwise on the client, we can't generate a link with the ID in it.

12
00:00:53,290 --> 00:01:00,490
Then back to the client, we should take all this code which disables the button and so on into this then

13
00:01:00,490 --> 00:01:06,520
block so that this only happens once the data was sent to the server and we got a response

14
00:01:06,520 --> 00:01:12,790
and now here from data we need to get that ID, the location ID we get this from data.locId,

15
00:01:13,210 --> 00:01:14,810
why locId?

16
00:01:14,830 --> 00:01:18,430
Well because on the response, we're sending this locId field,

17
00:01:18,490 --> 00:01:21,610
that's part of our JSON response, on the client

18
00:01:21,610 --> 00:01:27,940
we're parsing this JSON data, so we get an object which will have this locId field and now the location

19
00:01:27,940 --> 00:01:29,400
ID should be part of that

20
00:01:29,440 --> 00:01:30,190
URL.

21
00:01:30,610 --> 00:01:37,930
So we replace this part here with locId or location equals

22
00:01:38,050 --> 00:01:45,820
and now we inject the location ID here, so that now the link contains the ID instead of the full

23
00:01:45,880 --> 00:01:47,850
address data.

24
00:01:47,850 --> 00:01:54,120
So with that, we should restart our server side server so that we take our changes here into account

25
00:01:54,750 --> 00:02:01,290
and then go to the running frontend application, maybe search for a 6th avenue again, find that place

26
00:02:01,290 --> 00:02:06,000
and now you'll see we got this link with our location ID here.

27
00:02:06,000 --> 00:02:10,080
Now let's make sure we also fetch that location by that ID

28
00:02:10,230 --> 00:02:13,950
with this URL, with this path on our backend server.
