forked from Transparency/kgroad-frontend2
Merge
This commit is contained in:
commit
32761ce479
@ -29,16 +29,18 @@ export async function generateMetadata({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//<<<<<<< HEAD:src/app/[locale]/news/[id]/page.tsx
|
||||||
const NewsDetails = async ({
|
const NewsDetails = async ({
|
||||||
params,
|
params,
|
||||||
}: {
|
}: {
|
||||||
params: { id: string; новость: string };
|
params: { id: string; новость: string };
|
||||||
}) => {
|
}) => {
|
||||||
|
//=======
|
||||||
|
//const NewsDetails = async ({ params }: { params: { id: string } }) => {
|
||||||
|
//>>>>>>> master:src/app/news/[id]/page.tsx
|
||||||
const getNewsById = async () => {
|
const getNewsById = async () => {
|
||||||
const response = await apiInstance.get<INews>(
|
const response = await apiInstance.get<INews>(`/news/${params.id}/`);
|
||||||
`/news/${params.id}/`
|
console.log(response);
|
||||||
);
|
|
||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,9 +73,9 @@ const NewsDetails = async ({
|
|||||||
<Image src={calendar} alt="Calendar Icon" />
|
<Image src={calendar} alt="Calendar Icon" />
|
||||||
<p>
|
<p>
|
||||||
{months[data.created_at.slice(5, 7)]}{" "}
|
{months[data.created_at.slice(5, 7)]}{" "}
|
||||||
{data.created_at.slice(5, 7).slice(0, 1) === "0"
|
{data.created_at.slice(8, 10) === "0"
|
||||||
? data.created_at.slice(6, 7)
|
? data.created_at.slice(9, 10)
|
||||||
: data.created_at.slice(5, 7)}
|
: data.created_at.slice(8, 10)}
|
||||||
, {data.created_at.slice(0, 4)}
|
, {data.created_at.slice(0, 4)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
25
src/widgets/GoogleAnalyticsWidget/GoogleAnalyticsWidget.tsx
Normal file
25
src/widgets/GoogleAnalyticsWidget/GoogleAnalyticsWidget.tsx
Normal file
@ -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 (
|
||||||
|
<div><p>Total cummulative visitors: {data.visitors}</p></div>
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export default GoogleAnalyticsWidget;
|
Loading…
Reference in New Issue
Block a user