fix: correct localStorage token name from 'token' to 'authToken'

Fixed authentication token inconsistency in subscription pages:

Issue:
- Subscription pages were using localStorage.getItem('token')
- Rest of the app uses localStorage.getItem('authToken')
- This caused users to be redirected to login when accessing subscription pages

Files Fixed:
- app/[locale]/subscription/page.tsx
  * fetchUserData() function
  * handleUpgrade() function
  * handleManageSubscription() function
- app/[locale]/subscription/success/page.tsx
  * SuccessContent component verification
- components/subscription/usage-display.tsx
  * fetchUsageData() function

Result:
- Users can now access subscription pages when logged in
- Consistent authentication token naming across entire app
- No more unwanted redirects to login page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-12 22:35:34 +00:00
parent a667574d50
commit bc9fe1d9bb
3 changed files with 5 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ export default function SubscriptionPage() {
const fetchUserData = async () => {
try {
const token = localStorage.getItem('token')
const token = localStorage.getItem('authToken')
if (!token) {
router.push(`/${locale}/login`)
return
@@ -92,7 +92,7 @@ export default function SubscriptionPage() {
setError('')
try {
const token = localStorage.getItem('token')
const token = localStorage.getItem('authToken')
if (!token) {
router.push(`/${locale}/login`)
return
@@ -133,7 +133,7 @@ export default function SubscriptionPage() {
setError('')
try {
const token = localStorage.getItem('token')
const token = localStorage.getItem('authToken')
if (!token) {
router.push(`/${locale}/login`)
return

View File

@@ -44,7 +44,7 @@ function SuccessContent() {
// Give webhooks a moment to process, then verify the user's subscription
const timer = setTimeout(async () => {
try {
const token = localStorage.getItem('token')
const token = localStorage.getItem('authToken')
if (!token) {
router.push(`/${locale}/login`)
return