1
00:00:01,470 --> 00:00:05,540
Let's go ahead and create a couple of different files and folders to store our action type in them,

2
00:00:05,550 --> 00:00:07,600
these action types, all this good stuff.

3
00:00:08,250 --> 00:00:12,720
So inside my state directory, I'm going to first begin by creating a new folder called Actions.

4
00:00:13,580 --> 00:00:20,420
Inside, they're going to make a new file called Index Dots, so inside this file, we're going to place

5
00:00:20,420 --> 00:00:25,710
all of our different interfaces that describe the different kinds of actions that exist inside of rap.

6
00:00:26,390 --> 00:00:27,730
So I'll go back over to my producer.

7
00:00:28,430 --> 00:00:33,980
I'm going to take everything from search repositories, action, this interface right here all the way

8
00:00:33,980 --> 00:00:36,710
down to our type of action.

9
00:00:38,080 --> 00:00:39,670
I'm going to cut all that.

10
00:00:40,880 --> 00:00:43,400
And then paste it into that new index doctor's file.

11
00:00:45,100 --> 00:00:50,410
I'm going to make sure that I export this type of action down here because we eventually want to use

12
00:00:50,410 --> 00:00:54,400
this kind of multi type thing down here in several other locations.

13
00:00:56,040 --> 00:00:58,050
We are getting an air around action type.

14
00:00:58,080 --> 00:00:59,250
We'll pick that up in just a moment.

15
00:00:59,250 --> 00:01:00,900
But right now, I'm going to save this file.

16
00:01:02,470 --> 00:01:08,560
Then back inside my state directory, I'll make another new folder of action types inside there, I'll

17
00:01:08,560 --> 00:01:11,320
make a new file of index dots.

18
00:01:13,790 --> 00:01:16,730
Inside my producer, I'm going to find our action type Inam.

19
00:01:20,330 --> 00:01:23,960
And then paste it into the new action types index dots file.

20
00:01:24,750 --> 00:01:27,170
I'm also going to make sure that I export this as well.

21
00:01:29,720 --> 00:01:35,090
OK, so let's now fix up a couple of different import statements and whatnot first instead of actions

22
00:01:35,090 --> 00:01:36,080
inducts.

23
00:01:37,760 --> 00:01:45,860
I'll go up to the very top and import action type from up one directory, one directory action types.

24
00:01:48,640 --> 00:01:50,650
Then inside of my repositories reducer.

25
00:01:51,920 --> 00:01:53,870
At the very top, I will import.

26
00:01:55,570 --> 00:02:04,630
Action type from up on directory action types and action from up directory actions.

27
00:02:09,039 --> 00:02:14,220
Now we've got a much better structure now the only thing that we might want to change for this structure,

28
00:02:14,220 --> 00:02:19,500
as our application starts to grow in size, all of our different action types can always be added into

29
00:02:19,500 --> 00:02:21,970
this action types index dots file.

30
00:02:22,110 --> 00:02:27,270
So this enum can start to collect many more different action types over time, even if we start to add

31
00:02:27,270 --> 00:02:31,820
in massively different parts of redox functionality to our application.

32
00:02:31,850 --> 00:02:36,030
So if we start to add in many different kinds of reducers and whatnot and we start ending up with many

33
00:02:36,030 --> 00:02:39,480
different kinds of action types, we would continue to add them all into this enum.

34
00:02:40,260 --> 00:02:44,550
If we start to add in many different kinds of actions, that means that for every different action we

35
00:02:44,550 --> 00:02:46,470
would want to add in another interface.

36
00:02:46,740 --> 00:02:50,760
We could start to create some additional files inside this action directory.

37
00:02:51,570 --> 00:02:56,220
For example, if we wanted to kind of extract all this stuff around repositories and whatnot, we could

38
00:02:56,220 --> 00:03:02,670
create a repositories file inside the actions directory and then move these three interface definitions

39
00:03:02,670 --> 00:03:03,270
inside there.

40
00:03:03,570 --> 00:03:07,740
And that would just allow us to add in many, many more interfaces over time while keeping our code

41
00:03:07,740 --> 00:03:09,000
structure fairly clean.

42
00:03:09,480 --> 00:03:12,180
So that's how we could very easily expand this kind of pattern.

43
00:03:13,080 --> 00:03:14,280
OK, so this all looks good.

44
00:03:14,500 --> 00:03:19,550
It's now the last big thing we really need to do is take care of our actual store setup.

45
00:03:19,980 --> 00:03:24,480
We also need to make sure that we eventually create an action creator that will be responsible for actually

46
00:03:24,510 --> 00:03:31,020
making that request over to the API and then eventually dispatching an action of type search repositories

47
00:03:31,020 --> 00:03:32,790
or success or whatever else.

48
00:03:33,630 --> 00:03:36,350
So let's take care of these last couple of steps in just a moment.

