You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/AfterLogin.jsx
+21-6Lines changed: 21 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
-
importReact,{useState}from'react';
1
+
importReact,{useState}from'react';
2
2
import{useUser}from'../lib/hooks';
3
3
4
4
exportdefaultfunctionafterLogin(){
5
5
const[errorMsg,setErrorMsg]=useState("");
6
-
const[user]=useUser();
6
+
const[user]=useUser();
7
+
const[Loader,updateLoad]=useState(false);
7
8
consthandleSubmit=async(e)=>{
8
9
e.preventDefault();
10
+
updateLoad(true);
9
11
constbody={
10
12
message: e.currentTarget.message.value,
11
13
name: user.name
@@ -16,16 +18,17 @@ export default function afterLogin() {
16
18
body: JSON.stringify(body)
17
19
});
18
20
if(res.status===201){
19
-
M.toast({html: 'Message sent',classes:'green'})
21
+
M.toast({html: 'Message sent',classes:'green'})
20
22
}else{
21
23
setErrorMsg(awaitres.text());
22
24
}
25
+
updateLoad(false);
23
26
};
24
27
return(<divclassName="row">
25
28
<divclassName="col s12 m12">
26
29
<divclassName="card-panel horizontal blue ">
27
-
<spanclassName="white-text">Hey you made it here {user?user.name:'Stranger'}, we all were waiting for you.<br/>I hope you like this Authentication module, Its simple yet important to know.
28
-
I'll be updating it with many new stuff frequently.<br/><br/>Till then you can look around.<strong> Don't forget to drop a message for me.</strong></span>
30
+
<spanclassName="white-text">Hey you made it here {user ? user.name : 'Stranger'}, we all were waiting for you.<br/>I hope you like this Authentication module, Its simple yet important to know.
31
+
I'll be updating it with many new stuff frequently.<br/><br/>Till then you can look around.<strong> Don't forget to drop a message for me.</strong></span>
29
32
</div>
30
33
</div>
31
34
{errorMsg ? (
@@ -38,7 +41,19 @@ export default function afterLogin() {
38
41
<labelhtmlFor="message">Message for developer</label>
0 commit comments