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 ({
|
||||
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<INews>(
|
||||
`/news/${params.id}/`
|
||||
);
|
||||
|
||||
const response = await apiInstance.get<INews>(`/news/${params.id}/`);
|
||||
console.log(response);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@ -71,9 +73,9 @@ const NewsDetails = async ({
|
||||
<Image src={calendar} alt="Calendar Icon" />
|
||||
<p>
|
||||
{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)}
|
||||
</p>
|
||||
</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