All language subtitles for 012 Adding User Logout_Downloadly.ir_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,040 --> 00:00:02,873 So, let's make 2 00:00:02,873 --> 00:00:05,689 this Logout button here work. 3 00:00:05,689 --> 00:00:07,090 For this, of course, we can give it 4 00:00:07,090 --> 00:00:10,780 the onClick prop, and then trigger some function. 5 00:00:10,780 --> 00:00:12,483 A function, which I'll add here, 6 00:00:13,700 --> 00:00:16,000 and a function, which I'll name LogoutHandler. 7 00:00:17,770 --> 00:00:19,670 So, let's now, bind that function 8 00:00:19,670 --> 00:00:24,670 to this button now by pointing added Logout Handler. 9 00:00:25,580 --> 00:00:27,470 And now to logout we can, again, 10 00:00:27,470 --> 00:00:31,430 use another function provided by next-auth/client. 11 00:00:31,430 --> 00:00:36,200 And that is the signOut function with a capital O. 12 00:00:36,200 --> 00:00:38,170 We had signIn for logging in, 13 00:00:38,170 --> 00:00:41,120 we have signOut for, well ,signing out. 14 00:00:41,120 --> 00:00:43,890 So here we can call, signOut like this. 15 00:00:43,890 --> 00:00:45,960 And that, now, all returns a promise, 16 00:00:45,960 --> 00:00:47,600 which tells us when it's done. 17 00:00:47,600 --> 00:00:49,570 But here I don't even care about that 18 00:00:49,570 --> 00:00:51,780 because since I'm using useSession 19 00:00:51,780 --> 00:00:55,510 this component will be updated automatically anyways, 20 00:00:55,510 --> 00:00:58,160 as soon as the active session changes. 21 00:00:58,160 --> 00:01:00,650 And it will change when we sign out. 22 00:01:00,650 --> 00:01:03,770 Next.js will then clear that cookie 23 00:01:03,770 --> 00:01:05,810 and clear that information 24 00:01:05,810 --> 00:01:08,083 that the active user is logged in. 25 00:01:09,040 --> 00:01:13,400 Hence, if I now save here, if I reload I'm still logged in, 26 00:01:13,400 --> 00:01:16,090 I can still see the profile point here. 27 00:01:16,090 --> 00:01:18,883 But if I click logout that changes. 28 00:01:19,760 --> 00:01:23,180 Now, if you go to Application in the dev tools again, 29 00:01:23,180 --> 00:01:26,580 and we inspect our cookies, we also see 30 00:01:26,580 --> 00:01:29,360 that one very important cookie is missing, 31 00:01:29,360 --> 00:01:32,130 and this session token cookie. 32 00:01:32,130 --> 00:01:35,640 That's missing now because Next.js cleared that 33 00:01:35,640 --> 00:01:39,180 when we sent this signOut request. 34 00:01:39,180 --> 00:01:42,810 Now, of course, we can still sign in again though, 35 00:01:42,810 --> 00:01:45,483 if we enter valid credentials, 36 00:01:46,520 --> 00:01:49,740 and then our UI updates appropriately. 37 00:01:49,740 --> 00:01:51,460 So, that is how this works. 38 00:01:51,460 --> 00:01:53,873 That's how we can logout and update the UI. 39 00:01:54,860 --> 00:01:58,700 Now, of course, it would be nice that if we are logged in, 40 00:01:58,700 --> 00:02:03,470 we can't even visit this login page here. 41 00:02:03,470 --> 00:02:06,000 And on the other end, if we are on profile 42 00:02:06,000 --> 00:02:10,050 and I logout I don't want to be able 43 00:02:10,050 --> 00:02:14,040 to stay on that logout page, and that's also something 44 00:02:14,040 --> 00:02:16,213 which we can implement with NextAuth. 3430

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