Stable-1
This commit is contained in:
1 parent
9f4fbfd963
commit
655fd7ff2c
26 files changed
+839
-513
No files matched your search
@@ -0,0 +1 @@
|
||||
NEXT_PUBLIC_API_URL=https://loolegostar-api.liara.run
|
||||
+5
-1
@@ -1,3 +1,7 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
"extends": "next",
|
||||
"rules": {
|
||||
"react/no-unescaped-entities": "off",
|
||||
"@next/next/no-page-custom-font": "off"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"platform": "next",
|
||||
"app": "loolegostar"
|
||||
}
|
||||
@@ -1,8 +1,26 @@
|
||||
/** @type {import('next').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: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: 'loolegostar-api.liara.run',
|
||||
port: ''
|
||||
},
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: '127.0.0.1',
|
||||
port: '8000'
|
||||
},
|
||||
|
||||
Generated
+739
-148
File diff suppressed because it is too large.
Load diff
+6
-2
@@ -24,10 +24,11 @@
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"eslint": "8.47.0",
|
||||
"eslint-config-next": "^13.5.4",
|
||||
"eslint-config-next": "^14.1.0",
|
||||
"lucide-react": "^0.298.0",
|
||||
"moment-jalaali": "^0.10.0",
|
||||
"next": "^13.5.4",
|
||||
"next": "^14.1.0",
|
||||
"next-scroll-restorer": "^0.9.7",
|
||||
"postcss": "8.4.28",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -37,5 +38,8 @@
|
||||
"tailwindcss": "3.3.3",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/moment-jalaali": "^0.7.9"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use client"
|
||||
import {useScrollRestorer} from 'next-scroll-restorer';
|
||||
const ClientSideScrollRestorer = () => {
|
||||
useScrollRestorer()
|
||||
return <></>
|
||||
}
|
||||
export default ClientSideScrollRestorer
|
||||
Binary file not shown.
@@ -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
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
}
|
||||
@@ -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="basis-full">سوابق سفارشات</div>
|
||||
|
||||
{orders ? orders.map((iteam, key)=>{
|
||||
{orders ? orders.map((iteam:any, key)=>{
|
||||
return (
|
||||
<Link href={`/orders/${iteam.id}/`}>
|
||||
<div key={key} className="basis-full border-gray-100 border-2 p-2 text-center rounded-xl bg-slate-200">
|
||||
<Link key={key} href={`/orders/${iteam.id}/`}>
|
||||
<div className="basis-full border-gray-100 border-2 p-2 text-center rounded-xl bg-slate-200">
|
||||
|
||||
<span className="ml-2">تاریخ</span>
|
||||
|
||||
|
||||
@@ -12,10 +12,25 @@ const Page = ()=>{
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
},[])
|
||||
|
||||
const query = useQuery({ queryKey: ['categoryProducts'], queryFn: async ()=>{
|
||||
|
||||
return await axiosInstance.get("shop/v2/product-category/list/")
|
||||
},refetchOnWindowFocus:false, onSuccess(result:any) {
|
||||
|
||||
setCategory(result.data)
|
||||
|
||||
setTimeout(async ()=>{
|
||||
const scrollpos = localStorage.getItem('scrollY')
|
||||
if (scrollpos){
|
||||
await window.scrollTo(0, parseInt(scrollpos));
|
||||
}
|
||||
|
||||
},150)
|
||||
|
||||
}, })
|
||||
|
||||
if(query.isLoading){
|
||||
@@ -35,7 +50,6 @@ const Page = ()=>{
|
||||
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">
|
||||
|
||||
{query.isSuccess?category.map((iteam:any)=>{
|
||||
return <ProductCategoryBox key={iteam.id} iteam={iteam} />
|
||||
}):null}
|
||||
|
||||
@@ -39,13 +39,13 @@ const Page = ({ params }: { params: { id: string } })=>{
|
||||
{products?.category_name}
|
||||
</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 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 className='grid grid-cols-2 gap-2 mt-2'>
|
||||
@@ -57,8 +57,17 @@ const Page = ({ params }: { params: { id: string } })=>{
|
||||
|
||||
|
||||
</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>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ const TicketIDPage = ({params}:{params: {id: number} })=>{
|
||||
<div className="border-t-2 mt-3 pt-2">
|
||||
<p className="text-sm">عکس و فایل ها:</p>
|
||||
<div className="flex flex-row gap-x-2">
|
||||
{item.comment_files.map((file:any, key: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>
|
||||
{item.comment_files.map((file:any, key2:any)=>{
|
||||
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>
|
||||
|
||||
@@ -144,7 +144,7 @@ const TicketIDPage = ({params}:{params: {id: number} })=>{
|
||||
<Label>عکس یا فایل</Label>
|
||||
{uploadCounter.map((value:any, key:any)=>{
|
||||
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" />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ const NewTicketPage = ()=>{
|
||||
<Label>عکس یا فایل</Label>
|
||||
{uploadCounter.map((value:any, key:any)=>{
|
||||
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" />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -80,7 +80,7 @@ const TicketPage = ()=>{
|
||||
|
||||
{tickets ? tickets.map((iteam, key)=>{
|
||||
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="text-center">
|
||||
|
||||
@@ -19,7 +19,7 @@ const Page = ()=>{
|
||||
|
||||
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",
|
||||
cache: 'no-store',
|
||||
headers: {
|
||||
|
||||
@@ -26,7 +26,7 @@ const Page = ()=>{
|
||||
}
|
||||
|
||||
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',
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -52,7 +52,7 @@ const Page = ()=>{
|
||||
if (roles.length==1) {
|
||||
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',
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -65,8 +65,6 @@ const Page = ()=>{
|
||||
|
||||
const tokenData = await getTokenRes.json();
|
||||
|
||||
console.log(tokenData)
|
||||
|
||||
|
||||
if('refresh' in tokenData){
|
||||
setCookieFn('isAuth', 'true', 365)
|
||||
|
||||
@@ -11,7 +11,7 @@ const MainLayoutUtil = ({children,}: {children: React.ReactNode})=>{
|
||||
const pathname = usePathname()
|
||||
|
||||
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>
|
||||
<ReactQueryProvider>
|
||||
|
||||
@@ -49,7 +49,7 @@ const OrdersList = ()=>{
|
||||
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'>
|
||||
<span>سبد خرید شما</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'>
|
||||
|
||||
<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>
|
||||
@@ -75,9 +75,9 @@ const OrdersList = ()=>{
|
||||
|
||||
{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 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="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>
|
||||
) : null}
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
|
||||
const imageLoader = ({ src, } : {src:string}) => {
|
||||
return `${src}`
|
||||
}
|
||||
|
||||
const ProductCategoryBox: any = (props:any)=>{
|
||||
const getScrollPostion = ()=>{
|
||||
|
||||
const scrollPy = window.scrollY
|
||||
setTimeout(()=>{
|
||||
localStorage.setItem("scrollY", scrollPy)
|
||||
}, 10)
|
||||
|
||||
|
||||
}
|
||||
return (
|
||||
<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>
|
||||
|
||||
<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">
|
||||
|
||||
@@ -15,7 +27,7 @@ const ProductCategoryBox: any = (props:any)=>{
|
||||
{`${props.iteam.product_count} نوع`}
|
||||
</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>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ function setCookieFn(name:string, value:string, daysToExpire:number) {
|
||||
}
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: 'http://127.0.0.1:8000/',
|
||||
baseURL: `${process.env.NEXT_PUBLIC_API_URL}/`,
|
||||
timeout: 2000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -39,7 +39,7 @@ axiosInstance.interceptors.response.use((response)=> {
|
||||
|
||||
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",
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
Reference in new issue
Block a user