Added cache revalidation logic
This commit is contained in:
parent
8a64bc6ec2
commit
77c76cd8ef
17
src/app/api/cache-revalidate/route.ts
Normal file
17
src/app/api/cache-revalidate/route.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { revalidateTag } from 'next/cache';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { FetchTags } from '@/shared/api/tags';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
revalidateTag(FetchTags.TAYLOR);
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (err) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to revalidate', detail: err },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
3
src/shared/api/tags.ts
Normal file
3
src/shared/api/tags.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export enum FetchTags {
|
||||
TAYLOR = 'taylor',
|
||||
}
|
||||
@ -1,10 +1,15 @@
|
||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';
|
||||
|
||||
import { FetchTags } from './tags';
|
||||
|
||||
const baseQuery = fetchBaseQuery({
|
||||
baseUrl: process.env.TAYLOR_API_ENDPOINT,
|
||||
headers: {
|
||||
Authorization: process.env.TAYLOR_API_TOKEN || '',
|
||||
},
|
||||
next: {
|
||||
tags: [FetchTags.TAYLOR],
|
||||
},
|
||||
});
|
||||
|
||||
export const taylorAPI = createApi({
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { Handshake } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { Partners } from '@/app/api-utlities/@types';
|
||||
@ -9,7 +10,6 @@ import { useTextController } from '@/shared/language/hooks/use-text-controller';
|
||||
import { Button } from '@/shared/shadcn-ui/button';
|
||||
|
||||
import { PartnersSlider } from './partners-slider';
|
||||
import Link from 'next/link';
|
||||
|
||||
interface PartnersSectionProps {
|
||||
partners: Partners;
|
||||
@ -62,7 +62,11 @@ export const PartnersSection = ({ partners }: PartnersSectionProps) => {
|
||||
<p className='mx-auto mb-6 max-w-2xl text-gray-600'>
|
||||
{t('home.partners.becomePartnerText')}
|
||||
</p>
|
||||
<Link href='mailto:info@oriyo.tj'>
|
||||
<Link
|
||||
href={`mailto:${t('common.partners.email')}?subject=${t('home.partners.becomePartnerTextEmailSubject')}`}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
>
|
||||
<Button className='bg-red-600 hover:bg-red-700'>
|
||||
{t('common.buttons.contactUs')}
|
||||
</Button>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user