All language subtitles for 005 Handling the Response_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,450 --> 00:00:07,140 In this lecture, we're going to handle the response from Firebase, we're using the create user function 2 00:00:07,140 --> 00:00:08,830 to initiate a request. 3 00:00:09,150 --> 00:00:12,240 It's possible we may receive an error from Firebase. 4 00:00:12,480 --> 00:00:19,260 We'll want to handle the error if that happens, since we're using async await syntax, we can't change 5 00:00:19,260 --> 00:00:20,310 the catch function. 6 00:00:20,610 --> 00:00:26,820 If we want to catch errors, we'll need to use the try catch block, surround the asynchronous statement 7 00:00:26,820 --> 00:00:28,410 with the try catch block. 8 00:00:30,940 --> 00:00:37,660 The catch block will have a parameter called error, every error will come with two properties, a code 9 00:00:37,660 --> 00:00:40,390 and a message we're not going to use either. 10 00:00:40,660 --> 00:00:44,490 Instead, we'll output a universal message for any error. 11 00:00:44,800 --> 00:00:48,070 This is to keep things simple in the catch block. 12 00:00:48,100 --> 00:00:50,240 We'll want to update the alert message. 13 00:00:50,530 --> 00:00:52,420 This way we can notify the user. 14 00:00:52,430 --> 00:00:53,790 Their submission failed. 15 00:00:54,340 --> 00:00:58,180 First will set the information property to false. 16 00:01:00,630 --> 00:01:03,070 The form doesn't need to be disabled anymore. 17 00:01:03,270 --> 00:01:09,660 We want to enable it again so that the user can correct their mistakes and submit the form afterward 18 00:01:09,690 --> 00:01:13,590 will set the alert variant property to be read. 19 00:01:13,590 --> 00:01:14,400 Five hundred. 20 00:01:16,900 --> 00:01:23,520 This value will change the alert box to the color red red is usually associated with error messages, 21 00:01:23,800 --> 00:01:30,040 the last property will update is the alert message set, the alert message property to the following. 22 00:01:30,580 --> 00:01:32,440 An unexpected error occurred. 23 00:01:32,620 --> 00:01:34,000 Please try again later. 24 00:01:36,330 --> 00:01:40,170 The last thing we'll do in the catch block is to return the function. 25 00:01:42,720 --> 00:01:48,540 This return statement will stop the function from executing further if we didn't return the function, 26 00:01:48,720 --> 00:01:51,120 the alert message would display a success. 27 00:01:51,120 --> 00:01:55,650 Message will test this in a moment, but there is a problem with this function. 28 00:01:55,950 --> 00:02:01,880 The variable user credentials is inaccessible outside of the tri catch statement. 29 00:02:02,280 --> 00:02:08,729 It's because we're defining the variable inside the block, which limits its scope and we want the variable 30 00:02:08,729 --> 00:02:10,830 to be available throughout the function. 31 00:02:10,889 --> 00:02:12,920 We'll need to define it at the top. 32 00:02:13,230 --> 00:02:15,540 Its initial value will be null. 33 00:02:18,140 --> 00:02:23,960 If everything works out, the code inside the catch block will never run, the alert message will tell 34 00:02:23,960 --> 00:02:30,860 the user they've successfully logged in before we update the alert messages will long be user credentials 35 00:02:30,860 --> 00:02:33,800 variable to verify the user was registered. 36 00:02:36,390 --> 00:02:41,220 Let's test things out, open the app in the browser with the console opened. 37 00:02:43,730 --> 00:02:46,670 Try registering an account without triggering an error. 38 00:02:56,410 --> 00:03:02,650 I'll receive a success message indicating that everything worked in the console, information about 39 00:03:02,650 --> 00:03:03,940 the user's credentials is. 40 00:03:04,750 --> 00:03:08,580 We'll look at this information later when we want to authenticate the user. 41 00:03:08,890 --> 00:03:12,070 This verifies everything works, but let's double check. 42 00:03:12,430 --> 00:03:14,890 Firebase will store the user for you. 43 00:03:15,160 --> 00:03:18,010 Open the firebase console in another tab. 44 00:03:20,650 --> 00:03:27,460 Navigate to the authentication page under this page, the user should be listed, if you don't see anything, 45 00:03:27,460 --> 00:03:30,190 you may want to refresh it by clicking on the refresh. 46 00:03:30,190 --> 00:03:33,100 Icon will find the user we created. 47 00:03:33,400 --> 00:03:37,090 Firebase will even generate a unique ID for our user. 48 00:03:39,560 --> 00:03:46,220 We've successfully created a user before we move on, let's test if the error works, switched back 49 00:03:46,220 --> 00:03:49,940 to the registration form, you will need to refresh the page. 50 00:03:52,450 --> 00:03:59,110 We need to refresh it because we've disabled the form, if the registration was a success after refreshing 51 00:03:59,110 --> 00:04:02,650 the page, try submitting the form again with the same information. 52 00:04:08,440 --> 00:04:13,000 Firebase will reject the registration because duplicate emails are not allowed. 53 00:04:13,390 --> 00:04:18,700 The alert message will be the color red with the message an unexpected error occurred. 54 00:04:18,730 --> 00:04:20,050 Please try again later. 55 00:04:20,560 --> 00:04:21,459 Fantastic. 56 00:04:21,640 --> 00:04:24,970 We're able to register the user by using a single function. 57 00:04:25,300 --> 00:04:31,210 Firebase handles the rest by sending the request, validating the information on their end, and then 58 00:04:31,210 --> 00:04:34,700 providing us with a response about the user's credentials. 59 00:04:35,080 --> 00:04:37,810 The only thing we have to handle is the response. 60 00:04:38,110 --> 00:04:42,790 By using FIREBASE, we don't have to worry about the backend logic as much. 61 00:04:43,000 --> 00:04:48,070 With a few clicks, we have an authentication system ready for us out of the box. 6131

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