|  | @@ -8,6 +8,7 @@ import { loginToPt } from "../../../actions/auth";
 | 
	
		
			
				|  |  |  import { connect } from "react-redux";
 | 
	
		
			
				|  |  |  import { ToastContainer, toast } from "react-toastify";
 | 
	
		
			
				|  |  |  import { getCsrf } from "../../../actions/security";
 | 
	
		
			
				|  |  | +import Swal from "sweetalert2";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -70,28 +71,37 @@ class Verifikasi extends React.Component {
 | 
	
		
			
				|  |  |          this.setState({ pt_id: selected_PT.value });
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |      onSubmit = async () => {
 | 
	
		
			
				|  |  | -        const getToken = await getCsrf();
 | 
	
		
			
				|  |  | -        const _csrf = getToken.token;
 | 
	
		
			
				|  |  | -        this.setState({ loading: true });
 | 
	
		
			
				|  |  | -        const { password } = this.state.formLogin;
 | 
	
		
			
				|  |  | -        const { pt_id } = this.state
 | 
	
		
			
				|  |  | -        const auth = await toast.promise(loginToPt(pt_id, password, _csrf), {
 | 
	
		
			
				|  |  | -            pending: "Loading",
 | 
	
		
			
				|  |  | -            success: "Success",
 | 
	
		
			
				|  |  | -            error: "Akun tidak ada",
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -        // const auth = await loginToPt(pt_id, password);
 | 
	
		
			
				|  |  | -        this.props.setToken(auth.data.token);
 | 
	
		
			
				|  |  | -        this.props.setUser(auth.data.user);
 | 
	
		
			
				|  |  | -        if (auth.data.user.role.id === 2022) {
 | 
	
		
			
				|  |  | -            location.href = "/pt/pemantauan"
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        } else if ([2020, 2021, 2023].includes(auth.data.user.role.id)) {
 | 
	
		
			
				|  |  | -            location.href = "/pt/pemantauan"
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +        if (this.props.user.role.id === 2024) {
 | 
	
		
			
				|  |  | +            Swal.fire({
 | 
	
		
			
				|  |  | +                icon: 'error',
 | 
	
		
			
				|  |  | +                title: 'Oops...',
 | 
	
		
			
				|  |  | +                html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 | 
	
		
			
				|  |  | +                confirmButtonColor: "#3e3a8e",
 | 
	
		
			
				|  |  | +                confirmButtonText: 'Oke'
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            const getToken = await getCsrf();
 | 
	
		
			
				|  |  | +            const _csrf = getToken.token;
 | 
	
		
			
				|  |  | +            this.setState({ loading: true });
 | 
	
		
			
				|  |  | +            const { password } = this.state.formLogin;
 | 
	
		
			
				|  |  | +            const { pt_id } = this.state
 | 
	
		
			
				|  |  | +            const auth = await toast.promise(loginToPt(pt_id, password, _csrf), {
 | 
	
		
			
				|  |  | +                pending: "Loading",
 | 
	
		
			
				|  |  | +                success: "Success",
 | 
	
		
			
				|  |  | +                error: "Akun tidak ada",
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            // const auth = await loginToPt(pt_id, password);
 | 
	
		
			
				|  |  | +            this.props.setToken(auth.data.token);
 | 
	
		
			
				|  |  | +            this.props.setUser(auth.data.user);
 | 
	
		
			
				|  |  | +            if (auth.data.user.role.id === 2022) {
 | 
	
		
			
				|  |  | +                location.href = "/pt/pemantauan"
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            } else if ([2020, 2021, 2023].includes(auth.data.user.role.id)) {
 | 
	
		
			
				|  |  | +                location.href = "/pt/pemantauan"
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.setState({ loading: false });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        this.setState({ loading: false });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |