fixing the logout isssue
This commit is contained in:
parent
ba8adbd1da
commit
05ffef32ed
1 changed files with 45 additions and 1 deletions
46
src/App.tsx
46
src/App.tsx
|
|
@ -236,6 +236,50 @@ export default function App() {
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
apiFetch(`${CONFIG.apiBaseUrl}/api/auth/logout/`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' }
|
||||||
|
})
|
||||||
|
.catch(err => console.error('Error logging out:', err))
|
||||||
|
.finally(() => {
|
||||||
|
// Reset all onboarding & profile states to their defaults
|
||||||
|
setIsProfileComplete(false)
|
||||||
|
setProfileStep(1)
|
||||||
|
setEmail('')
|
||||||
|
setPhone('')
|
||||||
|
setPassword('')
|
||||||
|
setConfirmPassword('')
|
||||||
|
setPolicyAccepted(false)
|
||||||
|
|
||||||
|
setPhoneVerified(false)
|
||||||
|
setEmailVerified(false)
|
||||||
|
setPhoneOtpSent(false)
|
||||||
|
setEmailOtpSent(false)
|
||||||
|
setEnteredPhoneOtp('')
|
||||||
|
setEnteredEmailOtp('')
|
||||||
|
|
||||||
|
setGstin('29AAAAA1111A1Z1')
|
||||||
|
setIsGstinVerified(false)
|
||||||
|
setAadharFile(null)
|
||||||
|
setPanFile(null)
|
||||||
|
|
||||||
|
setStoreName('My Artisan Handloom')
|
||||||
|
setStoreLogo(null)
|
||||||
|
setBusinessBio('Traditional weaving and local sustainable designs.')
|
||||||
|
setAddress({
|
||||||
|
street: '123 Handloom Lane',
|
||||||
|
city: 'Textile Town',
|
||||||
|
state: 'Karnataka',
|
||||||
|
pincode: '560001'
|
||||||
|
})
|
||||||
|
setMapCoordinates({ lat: 12.9716, lng: 77.5946 })
|
||||||
|
|
||||||
|
navigateTo('home', true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleRegisterSubmit = (e: React.FormEvent) => {
|
const handleRegisterSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
|
|
@ -548,7 +592,7 @@ export default function App() {
|
||||||
</nav>
|
</nav>
|
||||||
<div className="nav-buttons">
|
<div className="nav-buttons">
|
||||||
{currentPage === 'dashboard' ? (
|
{currentPage === 'dashboard' ? (
|
||||||
<button className="btn btn-secondary" onClick={() => navigateTo('home')}>
|
<button className="btn btn-secondary" onClick={handleLogout}>
|
||||||
Logout
|
Logout
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue