All language subtitles for 010 Redirecting The User_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,120 --> 00:00:05,060 Now that we saw how we can send a request 2 00:00:05,060 --> 00:00:08,460 with help of the token to a protected resource, 3 00:00:08,460 --> 00:00:09,900 let's come back to the front end 4 00:00:09,900 --> 00:00:13,750 and let's work on the feedback we provide to the user here. 5 00:00:13,750 --> 00:00:18,040 For example, I wanna redirect after we changed the password. 6 00:00:18,040 --> 00:00:22,170 I also want to redirect after we logged in. 7 00:00:22,170 --> 00:00:24,570 And I then also wanna make the log out button 8 00:00:24,570 --> 00:00:25,500 work and so on. 9 00:00:25,500 --> 00:00:27,150 But we'll get there step-by-step. 10 00:00:28,000 --> 00:00:31,260 Let's work on the log in redirection. 11 00:00:31,260 --> 00:00:35,310 In the AuthForm component, I basically wanna redirect here 12 00:00:35,310 --> 00:00:38,130 in this case, that we do have a token 13 00:00:38,130 --> 00:00:42,620 and we do log the user in, in our context API. 14 00:00:42,620 --> 00:00:46,690 Now redirecting is rather straight forward in the end. 15 00:00:46,690 --> 00:00:48,810 I'm using react router here 16 00:00:49,783 --> 00:00:53,743 and we can redirect then in this case by importing 17 00:00:55,150 --> 00:00:57,510 something from react router dom. 18 00:00:57,510 --> 00:01:00,210 And that something which we import here 19 00:01:00,210 --> 00:01:02,373 is the used history hook. 20 00:01:03,520 --> 00:01:07,190 With this hook, we can create a history object 21 00:01:07,190 --> 00:01:09,013 by calling use history. 22 00:01:09,860 --> 00:01:12,453 And we can then use this history object, 23 00:01:14,607 --> 00:01:17,020 here, to call replace, 24 00:01:17,020 --> 00:01:20,490 which redirects the user to a different page 25 00:01:20,490 --> 00:01:23,170 and replace simply means that the user 26 00:01:23,170 --> 00:01:26,200 can't use the back button thereafter to go back 27 00:01:26,200 --> 00:01:28,110 to the previous page. 28 00:01:28,110 --> 00:01:31,100 And here we could redirect the user to the starting page 29 00:01:31,937 --> 00:01:33,883 with just slash for example. 30 00:01:35,090 --> 00:01:39,100 If I do that, you should see that if I now do log in again 31 00:01:39,100 --> 00:01:42,110 with that user, with that new password, 32 00:01:42,110 --> 00:01:44,980 I'm redirected once that succeeded. 33 00:01:44,980 --> 00:01:47,520 So that's rather straightforward. 34 00:01:47,520 --> 00:01:52,490 Now, I also want to redirect after we changed the password. 35 00:01:52,490 --> 00:01:55,720 And of course that works in exactly the same way. 36 00:01:55,720 --> 00:01:57,930 We can go to the profile form 37 00:01:57,930 --> 00:02:02,160 and also import use history here 38 00:02:02,160 --> 00:02:04,950 from react router dom. 39 00:02:04,950 --> 00:02:08,449 And then also create this history object here 40 00:02:08,449 --> 00:02:10,083 by calling use history. 41 00:02:10,979 --> 00:02:14,860 And then once we know that we succeeded here, 42 00:02:14,860 --> 00:02:17,350 we can call history, replace, 43 00:02:17,350 --> 00:02:19,100 and then go somewhere else 44 00:02:19,100 --> 00:02:21,683 for example, again, to the starting page. 45 00:02:22,760 --> 00:02:24,730 Of course here you also don't have 46 00:02:24,730 --> 00:02:26,010 to redirect the user. 47 00:02:26,010 --> 00:02:28,130 It would be fine to stay on this page 48 00:02:28,130 --> 00:02:31,890 and present some success message with you as state 49 00:02:31,890 --> 00:02:34,340 you could manage some states which you then 50 00:02:34,340 --> 00:02:36,820 use to outputs a message if you want to 51 00:02:36,820 --> 00:02:40,030 but here I'll go for the redirect, but that's of course 52 00:02:40,030 --> 00:02:42,563 totally up to you, whether you want to do that. 53 00:02:43,500 --> 00:02:45,630 And if I quickly test this year 54 00:02:45,630 --> 00:02:49,280 by going back to that original password which I used before, 55 00:02:49,280 --> 00:02:51,033 that seems to work. 56 00:02:52,340 --> 00:02:53,820 So that's all working. 57 00:02:53,820 --> 00:02:57,033 Now let's work on the log out functionality. 4426

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.