Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Swal from 'sweetalert2';
- export default class ErrorHandler {
- static handle(response) {
- if (response.status == 401) {
- Swal({
- title: 'Não autorizado',
- type: 'error'
- });
- } else if (response.status == 404) {
- Swal({
- title: 'Não encontrado',
- type: 'warning'
- });
- } else if (response.status == 500) {
- Swal({
- title: 'Erro do Servidor Interno',
- type: 'error'
- });
- } else {
- Swal({
- title: 'Erro desconhecido',
- type: 'info'
- });
- }
- }
- }
Add Comment
Please, Sign In to add comment