This commit is contained in:
javad committed 2024-02-21 10:49:30 +03:30
1 parent 9f4fbfd963
commit 655fd7ff2c
26 files changed
+839 -513

No files matched your search

+1
View File
@@ -0,0 +1 @@
NEXT_PUBLIC_API_URL=https://loolegostar-api.liara.run
+5 -1
View File
@@ -1,3 +1,7 @@
{ {
"extends": "next/core-web-vitals" "extends": "next",
"rules": {
"react/no-unescaped-entities": "off",
"@next/next/no-page-custom-font": "off"
}
} }
+4
View File
@@ -0,0 +1,4 @@
{
"platform": "next",
"app": "loolegostar"
}
+18
View File
@@ -1,8 +1,26 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
images: { images: {
remotePatterns: [ remotePatterns: [
{ {
protocol: 'https',
hostname: 'loolegostar-api.liara.run',
port: ''
},
{
protocol: 'http',
hostname: '127.0.0.1', hostname: '127.0.0.1',
port: '8000' port: '8000'
}, },
+739 -148
View File
File diff suppressed because it is too large. Load diff
+6 -2
View File
@@ -24,10 +24,11 @@
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"eslint": "8.47.0", "eslint": "8.47.0",
"eslint-config-next": "^13.5.4", "eslint-config-next": "^14.1.0",
"lucide-react": "^0.298.0", "lucide-react": "^0.298.0",
"moment-jalaali": "^0.10.0", "moment-jalaali": "^0.10.0",
"next": "^13.5.4", "next": "^14.1.0",
"next-scroll-restorer": "^0.9.7",
"postcss": "8.4.28", "postcss": "8.4.28",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
@@ -37,5 +38,8 @@
"tailwindcss": "3.3.3", "tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"typescript": "5.1.6" "typescript": "5.1.6"
},
"devDependencies": {
"@types/moment-jalaali": "^0.7.9"
} }
} }
+7
View File
@@ -0,0 +1,7 @@
"use client"
import {useScrollRestorer} from 'next-scroll-restorer';
const ClientSideScrollRestorer = () => {
useScrollRestorer()
return <></>
}
export default ClientSideScrollRestorer
BIN
View File
Binary file not shown.
-160
View File
@@ -1,160 +0,0 @@
import { cookies, headers } from 'next/headers'
const api_url = 'http://127.0.0.1:8000/';
const rewrite_url = async (context:any, request:any)=>{
const { slug } = await context.params
const { searchParams } = await new URL(request.url)
const path = await slug.join("/")
const url_params = await searchParams.toString()
const full_url = url_params ? api_url+path+"?"+url_params : api_url+path+"/"
return full_url
}
export async function GET(request: Request, context: { params: any }) {
const new_api_url = await rewrite_url(context, request)
const cookiesList = cookies()
const refreshToken = cookiesList.get('refreshToken')
const accsessToken = cookiesList.get('accsessToken')
if (!accsessToken || !refreshToken ){ return Response.json('nextjs token not found'); }
const res = await fetch( new_api_url, {
cache: 'no-store',
method: request.method,
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer "+accsessToken.value.toString()
},
})
const data = await res.json()
return new Response(JSON.stringify(data),{
status: res.status,
})
}
export async function POST(request: Request, context: { params: any }) {
const cookiesList = await cookies()
const refreshToken = await cookiesList.get('refreshToken')
const accsessToken = await cookiesList.get('accsessToken')
if (!accsessToken || !refreshToken ){ return Response.json('token not found'); }
const new_api_url = await rewrite_url(context, request)
const payload = await request.json()
const res = await fetch( new_api_url, {
method: "POST",
cache: "no-store",
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer "+accsessToken.value.toString()
},
body: JSON.stringify(payload)
})
const data = await res.json()
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
})
}
export async function PUT(request: Request, context: { params: any }) {
const new_api_url = await rewrite_url(context, request)
const cookiesList = await cookies()
const refreshToken = await cookiesList.get('refreshToken')
const accsessToken = await cookiesList.get('accsessToken')
if (!accsessToken || !refreshToken ){ return Response.json('token not found'); }
const payload = await request.json()
const res = await fetch( new_api_url, {
method: request.method,
headers: {
'Content-Type': 'application/json',
'Authorization': accsessToken.toString()
},
body: JSON.stringify(payload)
})
return new Response(res.body,{
status: res.status,
headers: res.headers
})
}
export async function DELETE(request: Request, context: { params: any }) {
console.log("DELETE METHODDDD!!!!!!!!!!")
const new_api_url = await rewrite_url(context, request)
const cookiesList = await cookies()
const refreshToken = await cookiesList.get('refreshToken')
const accsessToken = await cookiesList.get('accsessToken')
if (!accsessToken || !refreshToken ){ return Response.json('token not found'); }
const res = await fetch( new_api_url, {
cache: 'no-store',
method: request.method,
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer "+accsessToken.value.toString()
}
})
return new Response(res.body,{
status: res.status,
headers: res.headers
})
}
export async function PATCH(request: Request, context: { params: any }) {
const cookiesList = await cookies()
const refreshToken = await cookiesList.get('refreshToken')
const accsessToken = await cookiesList.get('accsessToken')
if (!accsessToken || !refreshToken ){ return Response.json('token not found'); }
const new_api_url = await rewrite_url(context, request)
const payload = await request.json()
const res = await fetch( new_api_url, {
method: request.method,
headers: {
'Content-Type': 'application/json',
'Authorization': accsessToken.toString()
},
body: JSON.stringify(payload)
})
return new Response(res.body,{
status: res.status,
headers: res.headers
})
}
@@ -1,20 +0,0 @@
export async function POST(request: Request, context: { params: any }) {
const payload = await request.json()
const res = await fetch( "http://127.0.0.1:8000/auth/login/mobile/", {
method: "POST",
cache: "no-store",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload)
})
const data = await res.json()
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
})
}
@@ -1,28 +0,0 @@
export async function POST(request: Request, context: { params: any }) {
const payload = await request.json()
console.log("verifyyyyy 11")
const res = await fetch( "http://127.0.0.1:8000/auth/login/mobile/verify/", {
method: "POST",
cache: "no-store",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload)
})
console.log("verifyyyyy 22")
const data = await res.json()
console.log(res)
console.log(data)
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
})
}
@@ -1,70 +0,0 @@
import { cookies } from 'next/headers'
export async function GET(request: Request, context: { params: any }) {
//return Response.json("aaaa")
const cookiesList = await cookies()
const refreshToken = await cookiesList.get('refreshToken')
const res = await fetch( "http://localhost:8000/auth/token/refresh/", {
method: "POST",
cache: "no-store",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
refresh: refreshToken?.value
})
})
const data = await res.json()
if ('access' in data && 'refresh' in data){
await cookies().set({
name: 'accsessToken',
value:data.access,
httpOnly: true,
path: '/',
})
cookies().set({
name: 'refreshToken',
value:data.refresh,
httpOnly: true,
path: '/',
})
cookies().set({
name: 'isAuth',
value:'true',
path: '/',
})
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
});
} else {
/*cookies().set({
name: 'isAuth',
value:'false',
path: '/',
})*/
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
});
}
}
-48
View File
@@ -1,48 +0,0 @@
import { cookies } from 'next/headers'
export async function POST(request: Request, context: { params: any }) {
const payload = await request.json()
const res = await fetch( "http://127.0.0.1:8000/auth/token/", {
method: "POST",
cache: "no-store",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload)
})
const data = await res.json()
if ('access' in data && 'refresh' in data){
cookies().set({
name: 'accsessToken',
value:data.access,
httpOnly: true,
path: '/',
})
cookies().set({
name: 'refreshToken',
value:data.refresh,
httpOnly: true,
path: '/',
})
cookies().set({
name: 'isAuth',
value:'true',
path: '/',
})
}
return new Response(JSON.stringify(data),{
status: res.status,
headers: res.headers
})
}
-10
View File
@@ -1,10 +0,0 @@
import { cookies } from 'next/headers'
export async function GET(request: Request, context: { params: any }) {
cookies().set('accsessToken', '78541514545')
cookies().set('refreshToken', '545647565')
return Response.json("set shod")
}
+3 -3
View File
@@ -34,10 +34,10 @@ const Page = ()=>{
<div className="flex bg-white flex-col w-full md:w-6/12 border-black border-2 mx-auto mt-4 rounded-2xl p-2 gap-y-3"> <div className="flex bg-white flex-col w-full md:w-6/12 border-black border-2 mx-auto mt-4 rounded-2xl p-2 gap-y-3">
<div className="basis-full">سوابق سفارشات</div> <div className="basis-full">سوابق سفارشات</div>
{orders ? orders.map((iteam, key)=>{ {orders ? orders.map((iteam:any, key)=>{
return ( return (
<Link href={`/orders/${iteam.id}/`}> <Link key={key} href={`/orders/${iteam.id}/`}>
<div key={key} className="basis-full border-gray-100 border-2 p-2 text-center rounded-xl bg-slate-200"> <div className="basis-full border-gray-100 border-2 p-2 text-center rounded-xl bg-slate-200">
<span className="ml-2">تاریخ</span> <span className="ml-2">تاریخ</span>
+15 -1
View File
@@ -12,10 +12,25 @@ const Page = ()=>{
const queryClient = useQueryClient() const queryClient = useQueryClient()
useEffect(()=>{
},[])
const query = useQuery({ queryKey: ['categoryProducts'], queryFn: async ()=>{ const query = useQuery({ queryKey: ['categoryProducts'], queryFn: async ()=>{
return await axiosInstance.get("shop/v2/product-category/list/") return await axiosInstance.get("shop/v2/product-category/list/")
},refetchOnWindowFocus:false, onSuccess(result:any) { },refetchOnWindowFocus:false, onSuccess(result:any) {
setCategory(result.data) setCategory(result.data)
setTimeout(async ()=>{
const scrollpos = localStorage.getItem('scrollY')
if (scrollpos){
await window.scrollTo(0, parseInt(scrollpos));
}
},150)
}, }) }, })
if(query.isLoading){ if(query.isLoading){
@@ -35,7 +50,6 @@ const Page = ()=>{
return ( return (
<> <>
<div className="grid grid-cols-2 min-[1350px]:grid-cols-5 min-[767px]:grid-cols-3 min-[1100px]:grid-cols-4 gap-x-2 gap-y-2"> <div className="grid grid-cols-2 min-[1350px]:grid-cols-5 min-[767px]:grid-cols-3 min-[1100px]:grid-cols-4 gap-x-2 gap-y-2">
{query.isSuccess?category.map((iteam:any)=>{ {query.isSuccess?category.map((iteam:any)=>{
return <ProductCategoryBox key={iteam.id} iteam={iteam} /> return <ProductCategoryBox key={iteam.id} iteam={iteam} />
}):null} }):null}
+12 -3
View File
@@ -39,13 +39,13 @@ const Page = ({ params }: { params: { id: string } })=>{
{products?.category_name} {products?.category_name}
</span> </span>
<span onClick={()=>{ router.back() }} className='cursor-pointer bg-cyan-700 pr-1 pl-1 text-white text-[0.9rem] rounded'>بازگشت</span> <span onClick={()=>{ router.push('/shop', { scroll: false }) }} className='cursor-pointer bg-cyan-700 pr-1 pl-1 text-white text-[0.9rem] rounded'>بازگشت</span>
</div> </div>
<div className='w-full'> <div className='w-full'>
<Image className='mx-auto' alt="sdf" src={`http://127.0.0.1:8000/${products?.category_img}`} height={100} width={100} /> <Image className='mx-auto' alt="" src={`https://loolegostar-api.liara.run/${products?.category_img}`} height={150} width={150} />
</div> </div>
<div className='grid grid-cols-2 gap-2 mt-2'> <div className='grid grid-cols-2 gap-2 mt-2'>
@@ -57,8 +57,17 @@ const Page = ({ params }: { params: { id: string } })=>{
</div> </div>
<div className='flex flex-row mt-10 mb-10 border-t-[1px] pt-2'>
<h2 className='text-center'>محصول زیر فقط بر مبنای سفارش قابل تولید است</h2>
<div onClick={()=>{ router.back() }} className='w-full text-center bg-gray-800 text-white rounded mt-2 p-2'> </div>
<div onClick={()=>{ router.push('/shop', { scroll: false }) }} className='w-full text-center bg-gray-800 text-white rounded mt-2 p-2'>
<span>بازگشت به صفحه قبل</span> <span>بازگشت به صفحه قبل</span>
</div> </div>
+3 -3
View File
@@ -114,8 +114,8 @@ const TicketIDPage = ({params}:{params: {id: number} })=>{
<div className="border-t-2 mt-3 pt-2"> <div className="border-t-2 mt-3 pt-2">
<p className="text-sm">عکس و فایل ها:</p> <p className="text-sm">عکس و فایل ها:</p>
<div className="flex flex-row gap-x-2"> <div className="flex flex-row gap-x-2">
{item.comment_files.map((file:any, key:any)=>{ {item.comment_files.map((file:any, key2:any)=>{
return <Link target="_blank" key={key} className="bg-green-900 rounded-lg text-white pr-2 pl-2 pt-1 pb-0" href={`http://127.0.0.1:8000/${file.file}`}>{`${ decodeURIComponent(file.file.split('/').slice(-1)) }`}</Link> return <Link target="_blank" key={key2} className="bg-green-900 rounded-lg text-white pr-2 pl-2 pt-1 pb-0" href={`http://127.0.0.1:8000/${file.file}`}>{`${ decodeURIComponent(file.file.split('/').slice(-1)) }`}</Link>
})} })}
</div> </div>
@@ -144,7 +144,7 @@ const TicketIDPage = ({params}:{params: {id: number} })=>{
<Label>عکس یا فایل</Label> <Label>عکس یا فایل</Label>
{uploadCounter.map((value:any, key:any)=>{ {uploadCounter.map((value:any, key:any)=>{
return ( return (
<div className="flex flex-row justify-between gap-x-4 mb-2"> <div key={key} className="flex flex-row justify-between gap-x-4 mb-2">
<Input onChange={(e)=>{fileHandeler(e)}} type="file" /> <Input onChange={(e)=>{fileHandeler(e)}} type="file" />
</div> </div>
) )
+1 -1
View File
@@ -86,7 +86,7 @@ const NewTicketPage = ()=>{
<Label>عکس یا فایل</Label> <Label>عکس یا فایل</Label>
{uploadCounter.map((value:any, key:any)=>{ {uploadCounter.map((value:any, key:any)=>{
return ( return (
<div className="flex flex-row justify-between gap-x-4 mb-2"> <div key={key} className="flex flex-row justify-between gap-x-4 mb-2">
<Input onChange={(e)=>{fileHandeler(e)}} type="file" /> <Input onChange={(e)=>{fileHandeler(e)}} type="file" />
</div> </div>
) )
+1 -1
View File
@@ -80,7 +80,7 @@ const TicketPage = ()=>{
{tickets ? tickets.map((iteam, key)=>{ {tickets ? tickets.map((iteam, key)=>{
return ( return (
<TableRow className={`${ ( (key+1) % 2) == 0 ? 'bg-gray-100' : ''}`}> <TableRow key={key} className={`${ ( (key+1) % 2) == 0 ? 'bg-gray-100' : ''}`}>
<TableCell className="font-medium text-center">{key+1}</TableCell> <TableCell className="font-medium text-center">{key+1}</TableCell>
<TableCell className="text-center"> <TableCell className="text-center">
+1 -1
View File
@@ -19,7 +19,7 @@ const Page = ()=>{
const login = async ()=>{ const login = async ()=>{
const res = await fetch('http://127.0.0.1:8000/auth/login/mobile/', { const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login/mobile/`, {
method: "POST", method: "POST",
cache: 'no-store', cache: 'no-store',
headers: { headers: {
@@ -26,7 +26,7 @@ const Page = ()=>{
} }
const veifyLogin = async (optcode: string)=>{ const veifyLogin = async (optcode: string)=>{
const res = await fetch('http://127.0.0.1:8000/auth/login/mobile/verify/', { const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login/mobile/verify/`, {
cache: 'no-store', cache: 'no-store',
method: "POST", method: "POST",
headers: { headers: {
@@ -52,7 +52,7 @@ const Page = ()=>{
if (roles.length==1) { if (roles.length==1) {
const uuidOpt = await roles[0].uuid const uuidOpt = await roles[0].uuid
const getTokenRes = await fetch('http://127.0.0.1:8000/auth/token/', { const getTokenRes = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/token/`, {
cache: 'no-store', cache: 'no-store',
method: "POST", method: "POST",
headers: { headers: {
@@ -65,8 +65,6 @@ const Page = ()=>{
const tokenData = await getTokenRes.json(); const tokenData = await getTokenRes.json();
console.log(tokenData)
if('refresh' in tokenData){ if('refresh' in tokenData){
setCookieFn('isAuth', 'true', 365) setCookieFn('isAuth', 'true', 365)
@@ -11,7 +11,7 @@ const MainLayoutUtil = ({children,}: {children: React.ReactNode})=>{
const pathname = usePathname() const pathname = usePathname()
return ( return (
<div className={`basis-full md:mr-[8.9rem] ${pathname.startsWith('/shop') ? 'lg:ml-[20rem]': ''} `}> <div className={`basis-full md:mr-[8.9rem] ${pathname.startsWith('/shop') ? 'lg:ml-[17rem]': ''} `}>
<ReduxProvider> <ReduxProvider>
<ReactQueryProvider> <ReactQueryProvider>
@@ -49,7 +49,7 @@ const OrdersList = ()=>{
return ( return (
<> <>
<div className={`${cartIsOpen ? null : 'hidden' } bg-white lg:block w-full md:w-[20rem] h-screen border-r-[1px] fixed top-0 left-0`}> <div className={`${cartIsOpen ? null : 'hidden' } bg-white lg:block w-full md:w-[17rem] h-screen border-r-[1px] fixed top-0 left-0`}>
<div className='text-center bg-slate-600 p-4 text-white flex flex-row items-center justify-between md:justify-center'> <div className='text-center bg-slate-600 p-4 text-white flex flex-row items-center justify-between md:justify-center'>
<span>سبد خرید شما</span> <span>سبد خرید شما</span>
<span onClick={()=>{ setCartIsOpen(false) }} className="md:hidden bg-slate-900 rounded-lg pr-2 pl-2 pt-1 pb-1">بستن</span> <span onClick={()=>{ setCartIsOpen(false) }} className="md:hidden bg-slate-900 rounded-lg pr-2 pl-2 pt-1 pb-1">بستن</span>
@@ -66,7 +66,7 @@ const OrdersList = ()=>{
<div className='absolute bg-white bottom-0 right-0 w-full p-4'> <div className='absolute bg-white bottom-0 right-0 w-full p-4'>
<p className='text-center mb-2 text-gray-500'>مشاهده کامل سبد خرید</p> <p className='text-center mb-2 text-gray-500'>مشاهده کامل سبد خرید</p>
<div onClick={submitOrder} className='w-full bg-green-900 text-white mb-2 rounded text-center pt-2 pb-2'> <div onClick={submitOrder} className='w-full bg-green-900 cursor-pointer text-white mb-2 rounded text-center pt-2 pb-2'>
ثبت نهایی ثبت نهایی
</div> </div>
</div> </div>
@@ -75,9 +75,9 @@ const OrdersList = ()=>{
{cartData.length > 0 ? ( {cartData.length > 0 ? (
<div className={`${cartIsOpen? 'hidden': null } md:hidden fixed bottom-0 right-0 pb-4 flex w-full flex-row items-center justify-center`}> <div className={`${cartIsOpen? 'hidden': null } md:hidden fixed bottom-0 right-0 pb-4 flex w-full flex-row items-center justify-center`}>
<div onClick={()=>{ setCartIsOpen(true) }} className='bg-cyan-800 text-white rounded-lg pt-2 pb-2 pr-4 pl-4'> <div onClick={()=>{ setCartIsOpen(true) }} className='bg-cyan-800 cursor-pointer text-white rounded-lg pt-2 pb-2 pr-4 pl-4'>
<span className="pr-1 pl-1" >مشاهده سبد خرید</span> <span className="pr-1 pl-1" >مشاهده سبد خرید</span>
<span className="rounded bg-cyan-950 inline-block text-center h-[30px] w-[30px]">{cartData ? cartData.length : null}</span> <span className="rounded bg-cyan-950 inline-block text-center h-[30px] w-[30px] cursor-pointer">{cartData ? cartData.length : null}</span>
</div> </div>
</div> </div>
) : null} ) : null}
@@ -1,13 +1,25 @@
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
const imageLoader = ({ src, } : {src:string}) => {
return `${src}`
}
const ProductCategoryBox: any = (props:any)=>{ const ProductCategoryBox: any = (props:any)=>{
const getScrollPostion = ()=>{
const scrollPy = window.scrollY
setTimeout(()=>{
localStorage.setItem("scrollY", scrollPy)
}, 10)
}
return ( return (
<div className="flex flex-col bg-white text-center rounded overflow-hidden text-white border-solid border-[1px] border-slate-700"> <div className="flex flex-col bg-white text-center rounded overflow-hidden text-white border-solid border-[1px] border-slate-700">
<h2 className="bg-slate-600 mb-2">{props.iteam.name}</h2> <h2 className="bg-slate-600 mb-2">{props.iteam.name}</h2>
<Image className="p-1 mx-auto" alt="a" width={"200"} height={"100"} src={`http://127.0.0.1:8000/${props.iteam.image}`} /> <Image loader={imageLoader} className="p-1 mx-auto" alt="a" width={"200"} height={"200"} src={`${process.env.NEXT_PUBLIC_API_URL}/${props.iteam.image}`} />
<div className="flex justify-between text-black border-t-[1px] mt-2 p-1"> <div className="flex justify-between text-black border-t-[1px] mt-2 p-1">
@@ -15,7 +27,7 @@ const ProductCategoryBox: any = (props:any)=>{
{`${props.iteam.product_count} نوع`} {`${props.iteam.product_count} نوع`}
</span> </span>
<Link href={`shop/product/${props.iteam.id}/`} className="bg-emerald-800 rounded text-white text-[0.8rem] pr-2 pl-2"> <Link onClick={getScrollPostion} href={`shop/product/${props.iteam.id}/`} scroll={false} className="bg-emerald-800 rounded text-white text-[0.8rem] pr-2 pl-2">
<span>مشاهده</span> <span>مشاهده</span>
</Link> </Link>
</div> </div>
+2 -2
View File
@@ -12,7 +12,7 @@ function setCookieFn(name:string, value:string, daysToExpire:number) {
} }
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: 'http://127.0.0.1:8000/', baseURL: `${process.env.NEXT_PUBLIC_API_URL}/`,
timeout: 2000, timeout: 2000,
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@@ -39,7 +39,7 @@ axiosInstance.interceptors.response.use((response)=> {
try { try {
const res = await fetch("http://127.0.0.1:8000/auth/token/refresh/", { const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/token/refresh/`, {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',