|
|
@@ -4,6 +4,7 @@ import Router from "next/router";
|
|
|
import FormValidator from "@/components/Forms/Validator.js";
|
|
|
import { connect } from "react-redux";
|
|
|
import { login, getUser } from "@/actions/auth";
|
|
|
+import { createLog } from "@/actions/log";
|
|
|
import axiosAPI from "@/config/axios";
|
|
|
import { getPT } from "@/actions/PT";
|
|
|
|
|
|
@@ -71,9 +72,13 @@ class Login extends Component {
|
|
|
axiosAPI.defaults.headers.common["Authorization"] = auth.data.token;
|
|
|
this.setState({ loading: false });
|
|
|
if (auth.data.user.role.id === 2022) {
|
|
|
+ await createLog(auth.data.token, { aktivitas: "Berhasil Login" });
|
|
|
Router.push({ pathname: "/pt/pemantauan" });
|
|
|
+ return;
|
|
|
} else if ([2020, 2021, 2023].includes(auth.data.user.role.id)) {
|
|
|
+ await createLog(auth.data.token, { aktivitas: "Berhasil Login" });
|
|
|
Router.push({ pathname: "/app/pemantauan" });
|
|
|
+ return;
|
|
|
} else {
|
|
|
this.setState({ error: "Akun tidak ada" });
|
|
|
}
|