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
"It seems like you are already member of our slack.<br>Visit <a href=https://hpedev.slack.com target='_blank' > <b> HPE Developer Community</b></a> on slack";
52
-
Swal.fire({
53
-
title: 'Success',
54
-
html: el,
55
-
icon: 'success',
56
-
});
57
-
}elseif(error==='already_in_team_invited_user'){
58
-
constl=document.createElement('div');
59
-
l.innerHTML=`Please check again <b style="font-size:large;" > ${email} </b> for an invite from Slack.<br>Visit <a href=https://developer.hpe.com/ target="_blank"> HPE Developer Community</a>`;
60
-
Swal.fire({
61
-
title: 'It seems like we already sent you our slack invite',
62
-
html: l,
63
-
icon: 'info',
64
-
});
65
-
}else{
66
-
if(error==='invalid_email'){
67
-
error='The email you entered is an invalid email.';
68
-
}elseif(error==='invalid_auth'){
69
-
error=
70
-
'Something has gone wrong. Please'+
71
-
' contact a system administrator.';
72
-
}
73
-
Swal.fire({
74
-
title: 'Error',
75
-
html: error,
76
-
icon: 'error',
77
-
});
78
-
}
79
-
}
80
-
})
81
-
.catch((err)=>{
82
-
Swal.fire({
83
-
title: 'Error !',
84
-
html: err,
85
-
icon: 'error',
86
-
});
87
-
});
88
-
};// end of doInvite
89
-
doInvite();
90
-
}// end of if statement
91
-
else{
92
-
consterrMsg=[];
93
-
if(!email){
94
-
errMsg.push('your email is required');
95
-
}
26
+
27
+
if(!email){
96
28
Swal.fire({
97
-
html: `Failed! ${errMsg.join(' and ')}.`,
29
+
html: `Failed! your email is required.`,
98
30
icon: 'info',
99
31
});
32
+
return;
33
+
}
34
+
35
+
try{
36
+
constresponse=awaitfetch(slackInviteApi,{
37
+
method: 'POST',
38
+
headers: {'Content-Type': 'application/json'},
39
+
body: JSON.stringify({ email }),
40
+
});
41
+
42
+
constres=awaitresponse.json();
43
+
44
+
if(response.ok){
45
+
Swal.fire({
46
+
title: 'Success!',
47
+
html: `Please check <b>${email}</b> for an invite from Slack.`,
htmlContent=`It looks like you're already a member. Visit <a href="https://hpedev.slack.com" target="_blank"><b>HPE Developer Community</b></a> on Slack.`;
56
+
}elseif(error==='already_in_team_invited_user'){
57
+
htmlContent=`An invite was already sent to <b>${email}</b>. Please check your inbox.<br>Visit <a href="https://developer.hpe.com/" target="_blank">HPE Developer Community</a>.`;
58
+
}elseif(error==='invalid_email'){
59
+
htmlContent='The email you entered is invalid.';
60
+
}else{
61
+
htmlContent=
62
+
error||'Something went wrong. Please try again later.';
63
+
}
64
+
65
+
Swal.fire({
66
+
title: 'Slack Invite Info',
67
+
html: htmlContent,
68
+
icon: 'info',
69
+
});
70
+
}
71
+
}catch(err){
72
+
Swal.fire({
73
+
title: 'Error!',
74
+
html: err.message||'Unknown error occurred.',
75
+
icon: 'error',
76
+
});
77
+
}finally{
78
+
setTimeout(()=>{
79
+
setEmail('');
80
+
},2500);
100
81
}
101
-
setTimeout(()=>{
102
-
setemail('');
103
-
},2500);
104
82
};
105
-
consthandlechange=(event)=>{
106
-
setemail(event.target.value);
83
+
consthandleChange=(event)=>{
84
+
setEmail(event.target.value);
107
85
};
108
86
return(
109
87
<Layout>
@@ -151,7 +129,7 @@ export default function Slacksignup() {
0 commit comments