Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,090 --> 00:00:05,080
So for the all events page
2
00:00:05,080 --> 00:00:08,220
the question is what we wanna to do there?
3
00:00:08,220 --> 00:00:11,500
And I would say that we probably still want
4
00:00:11,500 --> 00:00:14,170
to statically generate this page.
5
00:00:14,170 --> 00:00:17,410
So that we wanna fetch all the data in advance
6
00:00:17,410 --> 00:00:20,563
with get static props.
7
00:00:20,563 --> 00:00:23,370
Therefore, just us before on this page
8
00:00:23,370 --> 00:00:26,440
I'll export my async function,
9
00:00:26,440 --> 00:00:28,880
get static props
10
00:00:28,880 --> 00:00:31,910
and then in there we wanna get all the events
11
00:00:31,910 --> 00:00:34,280
and expose them full props
12
00:00:34,280 --> 00:00:36,763
to this all events page component.
13
00:00:37,820 --> 00:00:38,818
Now we do of course have
14
00:00:38,818 --> 00:00:43,570
this get all events function in API util.
15
00:00:43,570 --> 00:00:45,450
So we can utilize that
16
00:00:45,450 --> 00:00:50,280
and import get all events from not from dummy data,
17
00:00:50,280 --> 00:00:53,200
but from helpers API util
18
00:00:54,220 --> 00:00:56,410
and then go down there
19
00:00:56,410 --> 00:00:59,370
and get access to all events by awaiting
20
00:00:59,370 --> 00:01:02,120
the result of get all events.
21
00:01:02,120 --> 00:01:05,230
And then we return an object with a props key
22
00:01:05,230 --> 00:01:09,620
where I have my events which hold my events
23
00:01:09,620 --> 00:01:10,823
which I fetched here,
24
00:01:11,700 --> 00:01:13,193
simple like that.
25
00:01:14,160 --> 00:01:15,400
And now, since we exposed
26
00:01:15,400 --> 00:01:18,480
that full props We should expect props here.
27
00:01:18,480 --> 00:01:21,433
And now you use the events from the props.
28
00:01:22,400 --> 00:01:26,610
So here I'll set events equal to prop start events
29
00:01:26,610 --> 00:01:30,650
or alternatively we use object destructuring
30
00:01:30,650 --> 00:01:32,133
which is what I will do here.
31
00:01:33,500 --> 00:01:36,280
Now, we still need to use router hook here
32
00:01:36,280 --> 00:01:39,960
because here we're not using it to fetch some id
33
00:01:39,960 --> 00:01:43,050
or dynamic path segment value
34
00:01:43,050 --> 00:01:46,470
but instead we're using it for programmatic navigation
35
00:01:46,470 --> 00:01:48,320
which I still wanna enable here.
36
00:01:48,320 --> 00:01:50,163
So that stays the way it is.
37
00:01:51,330 --> 00:01:54,130
Now we can consider revalidating
38
00:01:54,130 --> 00:01:55,650
this page from time to time
39
00:01:55,650 --> 00:01:58,370
to make sure that we pick up new events.
40
00:01:58,370 --> 00:02:00,180
I think that makes a lot of sense
41
00:02:00,180 --> 00:02:02,550
so we should add revalidate here
42
00:02:02,550 --> 00:02:05,910
and then maybe set this to 60 seconds
43
00:02:05,910 --> 00:02:07,450
so that every minute
44
00:02:07,450 --> 00:02:09,310
if a new request is coming in,
45
00:02:09,310 --> 00:02:11,563
we regenerate this page.
46
00:02:12,470 --> 00:02:14,100
Now with that
47
00:02:14,100 --> 00:02:19,100
if I reload this again works just fine
48
00:02:20,080 --> 00:02:22,300
now, it's pregenerated though
49
00:02:22,300 --> 00:02:23,930
which is why in the page source
50
00:02:23,930 --> 00:02:26,363
we have all that event data.
51
00:02:28,040 --> 00:02:30,200
So that also works.
52
00:02:30,200 --> 00:02:32,470
Now,last but not least let's work
53
00:02:32,470 --> 00:02:35,080
on the slug on this slug page
54
00:02:35,080 --> 00:02:37,360
on this catch all page.
55
00:02:37,360 --> 00:02:39,700
That could be a bit more tricky
56
00:02:39,700 --> 00:02:41,500
because here we're catching
57
00:02:41,500 --> 00:02:45,903
multiple dynamic segments, multiple parameters.
4085
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.