Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. const fetchEmails = async () => {
  2. const res = await fetch('/api/admin/get-emails');
  3. if(res.ok){
  4. const {emails} = await res.json();
  5. setEmails(emails)
  6. }else{
  7. const err = await res.json();
  8. if(err.location){
  9. window.location.href = err.location
  10. }else{
  11. alert('DAFIQSIRDA SHECDOMA');
  12. };
  13. };
  14. };
  15.  
  16. useEffect(()=>{
  17. fetchEmails()
  18. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement