This commit is contained in:
Hamed
2026-08-03 12:21:55 +04:00
parent c2c2f6b378
commit ee456ff4bb
4 changed files with 76 additions and 8 deletions
+3
View File
@@ -3,3 +3,6 @@
# Neshan (نشان) map API key — get one from https://platform.neshan.org # Neshan (نشان) map API key — get one from https://platform.neshan.org
# Used by components/MapSection.jsx for the static map image. # Used by components/MapSection.jsx for the static map image.
NEXT_PUBLIC_NESHAN_API_KEY= NEXT_PUBLIC_NESHAN_API_KEY=
NEXT_PUBLIC_API_BASE_URL=https://your-real-backend.com
+12 -8
View File
@@ -2,14 +2,10 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="bb7b50a5-be9c-4cd7-a05b-979f0e91b173" name="Changes" comment="update"> <list default="true" id="bb7b50a5-be9c-4cd7-a05b-979f0e91b173" name="Changes" comment="update">
<change afterPath="$PROJECT_DIR$/lib/axios.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.env.local.example" beforeDir="false" afterPath="$PROJECT_DIR$/.env.local.example" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/page.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/app/page.jsx" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/page.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/app/page.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/components/HeroSection.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/HeroSection.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/content.js" beforeDir="false" afterPath="$PROJECT_DIR$/data/content.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/images/machine-slide-0.png" beforeDir="false" afterPath="$PROJECT_DIR$/public/images/machine-slide-0.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/images/machine-slide-2.png" beforeDir="false" afterPath="$PROJECT_DIR$/public/images/machine-slide-2.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/images/machine-slide-222.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/public/video/company-intro-placeholder.mp4" beforeDir="false" afterPath="$PROJECT_DIR$/public/video/company-intro-placeholder.mp4" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -92,7 +88,7 @@
<workItem from="1785583517424" duration="145000" /> <workItem from="1785583517424" duration="145000" />
<workItem from="1785645096071" duration="26000" /> <workItem from="1785645096071" duration="26000" />
<workItem from="1785646314677" duration="16621000" /> <workItem from="1785646314677" duration="16621000" />
<workItem from="1785730130350" duration="7877000" /> <workItem from="1785730130350" duration="8979000" />
</task> </task>
<task id="LOCAL-00001" summary="update"> <task id="LOCAL-00001" summary="update">
<option name="closed" value="true" /> <option name="closed" value="true" />
@@ -174,7 +170,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1785735982915</updated> <updated>1785735982915</updated>
</task> </task>
<option name="localTasksCounter" value="11" /> <task id="LOCAL-00011" summary="update">
<option name="closed" value="true" />
<created>1785744250045</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1785744250045</updated>
</task>
<option name="localTasksCounter" value="12" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
+2
View File
@@ -18,7 +18,9 @@ export default function HomePage() {
return ( return (
<main className="relative bg-page"> <main className="relative bg-page">
<Header/> <Header/>
<CartDrawer/> <CartDrawer/>
<ChatWidget/> <ChatWidget/>
<HeroSection/> <HeroSection/>
+59
View File
@@ -0,0 +1,59 @@
import axios from 'axios';
const api = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || 'https://api.example.com',
timeout: 15000,
headers: {
'Content-Type': 'application/json',
},
});
api.interceptors.request.use(
(config) => {
const token =
typeof window !== 'undefined' ? window.localStorage.getItem('rm-auth-token') : null;
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
// console.log('[API request]', config.method?.toUpperCase(), config.url);
return config;
},
(error) => Promise.reject(error)
);
api.interceptors.response.use(
(response) => response,
(error) => {
if (error.response) {
const status = error.response.status;
if (status === 401) {
// window.localStorage.removeItem('rm-auth-token');
// window.location.href = '/login';
}
if (status >= 500) {
// message.error('خطایی در سرور رخ داد. لطفاً بعداً تلاش کنید.');
}
} else if (error.request) {
// درخواست ارسال شد ولی هیچ جوابی نیومد (قطعی اینترنت، سرور خاموش و ...)
// TODO: message.error('اتصال با سرور برقرار نشد.');
}
return Promise.reject(error);
}
);
export default api;