From d399212b942d8362e5cf6c76c996442f5dfe3b70 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Fri, 30 Jun 2023 16:50:18 +0700
Subject: user activity

---
 src/core/components/layouts/BasicLayout.jsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'src/core/components/layouts/BasicLayout.jsx')

diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx
index 04b189f9..04b173fa 100644
--- a/src/core/components/layouts/BasicLayout.jsx
+++ b/src/core/components/layouts/BasicLayout.jsx
@@ -2,11 +2,28 @@ import dynamic from 'next/dynamic'
 import BasicFooter from '../elements/Footer/BasicFooter'
 import Image from 'next/image'
 import whatsappUrl from '@/core/utils/whatsappUrl'
+import { useEffect, useState } from 'react'
+import axios from 'axios'
+import odooApi from '@/core/api/odooApi'
 
 const Navbar = dynamic(() => import('../elements/Navbar/Navbar'))
 const AnimationLayout = dynamic(() => import('./AnimationLayout'))
 
 const BasicLayout = ({ children }) => {
+  
+  console.log('chiled', children)
+  useEffect(() => {
+    const getIP = async () => {
+      const ip = await odooApi('GET', '/api/ip-address')
+      const data = {
+        page_title: document.title,
+        url: window.location.href,
+        ip: ip
+      }
+      axios.get(`/api/user-activity?page_title=${data.page_title}&url=${data.url}&ip=${data.ip}`)
+    }
+    getIP()
+  }, [])
   return (
     <>
       <Navbar />
-- 
cgit v1.2.3

