Guest User

Untitled

a guest
Jul 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import Swal from 'sweetalert2';
  2.  
  3. export default class ErrorHandler {
  4. static handle(response) {
  5. if (response.status == 401) {
  6. Swal({
  7. title: 'Não autorizado',
  8. type: 'error'
  9. });
  10. } else if (response.status == 404) {
  11. Swal({
  12. title: 'Não encontrado',
  13. type: 'warning'
  14. });
  15. } else if (response.status == 500) {
  16. Swal({
  17. title: 'Erro do Servidor Interno',
  18. type: 'error'
  19. });
  20. } else {
  21. Swal({
  22. title: 'Erro desconhecido',
  23. type: 'info'
  24. });
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment