diff --git a/src/app/[locale]/news/[id]/page.tsx b/src/app/[locale]/news/[id]/page.tsx index 249bdd2..bbc10fc 100644 --- a/src/app/[locale]/news/[id]/page.tsx +++ b/src/app/[locale]/news/[id]/page.tsx @@ -29,16 +29,18 @@ export async function generateMetadata({ }; } +//<<<<<<< HEAD:src/app/[locale]/news/[id]/page.tsx const NewsDetails = async ({ params, }: { params: { id: string; новость: string }; }) => { +//======= +//const NewsDetails = async ({ params }: { params: { id: string } }) => { +//>>>>>>> master:src/app/news/[id]/page.tsx const getNewsById = async () => { - const response = await apiInstance.get( - `/news/${params.id}/` - ); - + const response = await apiInstance.get(`/news/${params.id}/`); + console.log(response); return response.data; }; @@ -71,9 +73,9 @@ const NewsDetails = async ({ Calendar Icon

{months[data.created_at.slice(5, 7)]}{" "} - {data.created_at.slice(5, 7).slice(0, 1) === "0" - ? data.created_at.slice(6, 7) - : data.created_at.slice(5, 7)} + {data.created_at.slice(8, 10) === "0" + ? data.created_at.slice(9, 10) + : data.created_at.slice(8, 10)} , {data.created_at.slice(0, 4)}

diff --git a/src/widgets/GoogleAnalyticsWidget/GoogleAnalyticsWidget.tsx b/src/widgets/GoogleAnalyticsWidget/GoogleAnalyticsWidget.tsx new file mode 100644 index 0000000..b2c5105 --- /dev/null +++ b/src/widgets/GoogleAnalyticsWidget/GoogleAnalyticsWidget.tsx @@ -0,0 +1,25 @@ +"use client" +import React, { useEffect, useState } from 'react'; +import { apiInstance } from "@/shared/config/apiConfig"; +import { AxiosError } from "axios"; + +const GoogleAnalyticsWidget = async () => { + + const getAnalytics = async () => { + try { + const response = await apiInstance.get("/report/google_analytics/"); + return response.data; + } catch (error: unknown) { + if (error instanceof AxiosError) console.log(error.message); + } + }; + + const data = await getAnalytics(); + + return ( +

Total cummulative visitors: {data.visitors}

+) + +}; + +export default GoogleAnalyticsWidget;