Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
b0a9a158
Commit
b0a9a158
authored
Apr 03, 2026
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor change
parent
3294a2f4
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
28 additions
and
41 deletions
+28
-41
page.tsx
...d)/(user)/(outsideAuth)/buy-coins/[slug]/success/page.tsx
+0
-2
AuthHydrator.tsx
src/components/Hydrators/AuthHydrator.tsx
+0
-1
PaymentModal.tsx
src/components/molecules/PaymentModal.tsx
+0
-1
index.tsx
src/components/organism/UpdatePassword/index.tsx
+1
-4
index.tsx
src/components/pages/auth/login/index.tsx
+0
-1
index.tsx
src/components/pages/auth/register/index.tsx
+0
-1
index.tsx
.../dashboard/adminDashboard/players/addPlayerForm/index.tsx
+1
-1
FortPay.tsx
...Dashboard/buyCoins/buyCoinSinlgeGame/checkout/FortPay.tsx
+0
-2
index.tsx
...mponents/pages/dashboard/userDashboard/buyCoins/index.tsx
+0
-2
CredentialsCard.tsx
...shboard/userDashboard/gameCredentials/CredentialsCard.tsx
+0
-4
ResetPasswordDialog.tsx
...ard/userDashboard/gameCredentials/ResetPasswordDialog.tsx
+0
-1
index.tsx
...ponents/pages/dashboard/userDashboard/withdrawl/index.tsx
+0
-2
ProtectedLink.tsx
src/routes/ProtectedLink.tsx
+0
-1
baseQuery.ts
src/services/baseQuery.ts
+25
-9
index.tsx
src/theme/index.tsx
+1
-2
authSession.ts
src/utils/authSession.ts
+0
-7
No files found.
src/app/(dashboard)/(user)/(outsideAuth)/buy-coins/[slug]/success/page.tsx
View file @
b0a9a158
...
@@ -22,13 +22,11 @@ export default function PaymentSuccess() {
...
@@ -22,13 +22,11 @@ export default function PaymentSuccess() {
useEffect
(()
=>
{
useEffect
(()
=>
{
const
hydrateAuthOnSuccess
=
async
()
=>
{
const
hydrateAuthOnSuccess
=
async
()
=>
{
try
{
try
{
console
.
log
(
'[PaymentSuccess] Starting auth hydration...'
);
// Try to restore auth from backup
// Try to restore auth from backup
const
result
=
restoreAuthFromCookies
();
const
result
=
restoreAuthFromCookies
();
if
(
result
.
success
&&
result
.
data
)
{
if
(
result
.
success
&&
result
.
data
)
{
console
.
log
(
`[PaymentSuccess] Auth restored from
${
result
.
source
}
`
);
// Update Redux store
// Update Redux store
dispatch
(
setTokens
({
dispatch
(
setTokens
({
...
...
src/components/Hydrators/AuthHydrator.tsx
View file @
b0a9a158
...
@@ -23,7 +23,6 @@ export default function AuthHydrator() {
...
@@ -23,7 +23,6 @@ export default function AuthHydrator() {
const
result
=
restoreAuthFromCookies
();
const
result
=
restoreAuthFromCookies
();
if
(
result
.
success
&&
result
.
data
)
{
if
(
result
.
success
&&
result
.
data
)
{
console
.
log
(
`[AuthHydrator] Restored auth from
${
result
.
source
}
`
);
// Dispatch to Redux to update app state
// Dispatch to Redux to update app state
dispatch
(
setTokens
({
dispatch
(
setTokens
({
...
...
src/components/molecules/PaymentModal.tsx
View file @
b0a9a158
...
@@ -138,7 +138,6 @@ export default function PaymentModal({
...
@@ -138,7 +138,6 @@ export default function PaymentModal({
});
});
if
(
found
)
{
if
(
found
)
{
console
.
log
(
'[PaymentModal] Detected success redirect URL:'
,
currentUrl
);
setHasDetectedSuccess
(
true
);
setHasDetectedSuccess
(
true
);
setIsLoading
(
false
);
setIsLoading
(
false
);
onSuccess
?.();
onSuccess
?.();
...
...
src/components/organism/UpdatePassword/index.tsx
View file @
b0a9a158
...
@@ -15,9 +15,7 @@ export default function UpdatePassword() {
...
@@ -15,9 +15,7 @@ export default function UpdatePassword() {
const
{
open
,
provider
}
=
useSelector
((
state
:
RootState
)
=>
state
?.
updatePasswordSlice
);
const
{
open
,
provider
}
=
useSelector
((
state
:
RootState
)
=>
state
?.
updatePasswordSlice
);
const
[
updateNewPassword
,
{
isLoading
}]
=
useUpdateUserGamePasswordMutation
();
const
[
updateNewPassword
,
{
isLoading
}]
=
useUpdateUserGamePasswordMutation
();
console
.
log
({
open
,
provider
})
const
formik
=
useFormik
({
const
formik
=
useFormik
({
initialValues
:
{
password
:
""
},
initialValues
:
{
password
:
""
},
validationSchema
:
Yup
.
object
({
validationSchema
:
Yup
.
object
({
...
@@ -28,7 +26,6 @@ export default function UpdatePassword() {
...
@@ -28,7 +26,6 @@ export default function UpdatePassword() {
onSubmit
:
async
(
values
)
=>
{
onSubmit
:
async
(
values
)
=>
{
try
{
try
{
console
.
log
(
"New password:"
,
values
.
password
);
const
response
=
await
updateNewPassword
({
const
response
=
await
updateNewPassword
({
password
:
values
.
password
,
password
:
values
.
password
,
provider
:
provider
||
""
provider
:
provider
||
""
...
...
src/components/pages/auth/login/index.tsx
View file @
b0a9a158
...
@@ -77,7 +77,6 @@ export default function LoginPage() {
...
@@ -77,7 +77,6 @@ export default function LoginPage() {
secure
:
process
.
env
.
NODE_ENV
===
'production'
,
secure
:
process
.
env
.
NODE_ENV
===
'production'
,
sameSite
:
'Strict'
,
sameSite
:
'Strict'
,
});
});
console
.
log
(
"Login Response:"
,
response
?.
data
?.
user
?.
role
.
toLowerCase
()
===
"user"
);
router
.
replace
(
response
?.
data
?.
user
?.
role
?.
toLowerCase
()
===
"user"
?
"/credentials"
:
"/"
);
router
.
replace
(
response
?.
data
?.
user
?.
role
?.
toLowerCase
()
===
"user"
?
"/credentials"
:
"/"
);
}
}
catch
(
e
:
any
)
{
catch
(
e
:
any
)
{
...
...
src/components/pages/auth/register/index.tsx
View file @
b0a9a158
...
@@ -168,7 +168,6 @@ export default function RegisterPage() {
...
@@ -168,7 +168,6 @@ export default function RegisterPage() {
autoTime
:
true
,
autoTime
:
true
,
}),
}),
);
);
console
.
log
(
"Register response:"
,
response
?.
data
?.
redirection_url
);
if
(
response
?.
data
?.
redirection_url
)
{
if
(
response
?.
data
?.
redirection_url
)
{
window
.
open
(
response
?.
data
?.
redirection_url
,
"_blank"
);
window
.
open
(
response
?.
data
?.
redirection_url
,
"_blank"
);
setAcuityUrl
(
response
.
data
.
redirection_url
);
setAcuityUrl
(
response
.
data
.
redirection_url
);
...
...
src/components/pages/dashboard/adminDashboard/players/addPlayerForm/index.tsx
View file @
b0a9a158
...
@@ -27,7 +27,7 @@ export const PlayerValidationSchema = (isEdit: boolean) => Yup.object().shape({
...
@@ -27,7 +27,7 @@ export const PlayerValidationSchema = (isEdit: boolean) => Yup.object().shape({
.
matches
(
/^
\+?\d{7,15}
$/
,
"Invalid phone number"
)
.
matches
(
/^
\+?\d{7,15}
$/
,
"Invalid phone number"
)
.
required
(
"Phone is required"
),
.
required
(
"Phone is required"
),
password
:
isEdit
password
:
isEdit
?
Yup
.
string
().
nullable
()
// not required in edit mode
?
Yup
.
string
().
nullable
()
:
Yup
.
string
().
min
(
6
,
"Password must be at least 6 characters"
).
required
(
"Password is required"
),
:
Yup
.
string
().
min
(
6
,
"Password must be at least 6 characters"
).
required
(
"Password is required"
),
password_confirmation
:
isEdit
?
Yup
.
string
().
nullable
()
:
Yup
.
string
().
when
(
"password"
,
{
password_confirmation
:
isEdit
?
Yup
.
string
().
nullable
()
:
Yup
.
string
().
when
(
"password"
,
{
is
:
(
val
:
string
)
=>
!!
val
,
is
:
(
val
:
string
)
=>
!!
val
,
...
...
src/components/pages/dashboard/userDashboard/buyCoins/buyCoinSinlgeGame/checkout/FortPay.tsx
View file @
b0a9a158
...
@@ -97,7 +97,6 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type:
...
@@ -97,7 +97,6 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type:
},
},
callback
:
async
(
response
:
any
)
=>
{
callback
:
async
(
response
:
any
)
=>
{
try
{
try
{
console
.
log
(
"token value is"
,
response
);
await
payViaFortPay
({
await
payViaFortPay
({
id
,
id
,
amount
,
amount
,
...
@@ -111,7 +110,6 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type:
...
@@ -111,7 +110,6 @@ export default function PaymentForm({ id, amount, type }: DepositProps & { type:
// Backup auth before redirecting to success page
// Backup auth before redirecting to success page
backupAuthToCookies
();
backupAuthToCookies
();
console
.
log
(
'[FortPay] Auth backed up before redirect'
);
router
.
push
(
`/buy-coins/
${
id
}
/success`
);
router
.
push
(
`/buy-coins/
${
id
}
/success`
);
}
catch
(
e
:
any
)
{
}
catch
(
e
:
any
)
{
...
...
src/components/pages/dashboard/userDashboard/buyCoins/index.tsx
View file @
b0a9a158
...
@@ -19,7 +19,6 @@ export default function BuyCoinGameListPage({
...
@@ -19,7 +19,6 @@ export default function BuyCoinGameListPage({
const
gameInfo
=
coins
?.
data
?.
game_information
||
{}
const
gameInfo
=
coins
?.
data
?.
game_information
||
{}
const
dispatch
=
useAppDispatch
();
const
dispatch
=
useAppDispatch
();
console
.
log
(
"coins"
,
coins
);
return
(
return
(
<
section
className=
"buy__coin__root"
>
<
section
className=
"buy__coin__root"
>
<
div
className=
"section__title mb-4 lg:mb-8 max-w-[520px]"
>
<
div
className=
"section__title mb-4 lg:mb-8 max-w-[520px]"
>
...
@@ -33,7 +32,6 @@ export default function BuyCoinGameListPage({
...
@@ -33,7 +32,6 @@ export default function BuyCoinGameListPage({
{
games
.
data
?.
data
.
map
((
game
)
=>
{
{
games
.
data
?.
data
.
map
((
game
)
=>
{
const
info
=
gameInfo
[
game
.
provider
.
toLowerCase
()]
||
{
balance
:
0
,
type
:
'sc'
}
const
info
=
gameInfo
[
game
.
provider
.
toLowerCase
()]
||
{
balance
:
0
,
type
:
'sc'
}
const
CoinIcon
=
info
.
type
===
'gc'
?
GoldCoinIcon
:
SilverCoinIcon
const
CoinIcon
=
info
.
type
===
'gc'
?
GoldCoinIcon
:
SilverCoinIcon
console
.
log
(
info
.
has_changed_password
)
return
(
return
(
<
div
key=
{
game
.
id
}
className=
{
`col-span-1 ${info.type === 'gc' ? "hidden" : ""}`
}
>
<
div
key=
{
game
.
id
}
className=
{
`col-span-1 ${info.type === 'gc' ? "hidden" : ""}`
}
>
...
...
src/components/pages/dashboard/userDashboard/gameCredentials/CredentialsCard.tsx
View file @
b0a9a158
...
@@ -43,7 +43,6 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
...
@@ -43,7 +43,6 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
const
dispatch
=
useAppDispatch
();
const
dispatch
=
useAppDispatch
();
const
newBalance
=
useAppSelector
((
state
)
=>
state
.
userBalanceSlice
);
const
newBalance
=
useAppSelector
((
state
)
=>
state
.
userBalanceSlice
);
console
.
log
(
"newBalance in cred card:"
,
newBalance
);
const
providerBalance
:
any
=
newBalance
.
providerAndBalance
const
providerBalance
:
any
=
newBalance
.
providerAndBalance
?.
find
((
item
:
any
)
=>
item
?.
provider
===
cred
.
name
);
?.
find
((
item
:
any
)
=>
item
?.
provider
===
cred
.
name
);
return
(
return
(
...
@@ -85,13 +84,11 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
...
@@ -85,13 +84,11 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
icon=
{
true
}
icon=
{
true
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
if
(
balance
?.
has_changed_password
)
{
if
(
balance
?.
has_changed_password
)
{
console
.
log
(
"password changes"
);
dispatch
(
openPasswordDialog
({
dispatch
(
openPasswordDialog
({
provider
:
cred
?.
name
,
provider
:
cred
?.
name
,
}));
}));
}
}
else
{
else
{
console
.
log
(
"password not changes"
);
refetch
();
refetch
();
}
}
}
}
}
}
...
@@ -139,7 +136,6 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
...
@@ -139,7 +136,6 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
onClick=
{
(
e
)
=>
{
onClick=
{
(
e
)
=>
{
if
(
balance
?.
has_changed_password
)
{
if
(
balance
?.
has_changed_password
)
{
e
.
preventDefault
();
e
.
preventDefault
();
console
.
log
(
"password changes"
);
dispatch
(
openPasswordDialog
({
dispatch
(
openPasswordDialog
({
provider
:
cred
?.
name
,
provider
:
cred
?.
name
,
}));
}));
...
...
src/components/pages/dashboard/userDashboard/gameCredentials/ResetPasswordDialog.tsx
View file @
b0a9a158
...
@@ -38,7 +38,6 @@ export default function ResetPasswordDialog({
...
@@ -38,7 +38,6 @@ export default function ResetPasswordDialog({
onClose
:
()
=>
void
;
onClose
:
()
=>
void
;
name
:
string
;
name
:
string
;
})
{
})
{
console
.
log
(
"ResetPasswordDialog name:"
,
name
);
const
dispatch
=
useAppDispatch
();
const
dispatch
=
useAppDispatch
();
const
[
resetGamePassord
,
{
isLoading
}]
=
useChangeUserGamePasswordMutation
();
const
[
resetGamePassord
,
{
isLoading
}]
=
useChangeUserGamePasswordMutation
();
...
...
src/components/pages/dashboard/userDashboard/withdrawl/index.tsx
View file @
b0a9a158
...
@@ -131,7 +131,6 @@ export default function WithdrawlPage({
...
@@ -131,7 +131,6 @@ export default function WithdrawlPage({
})
})
);
);
}
catch
(
e
:
any
)
{
}
catch
(
e
:
any
)
{
console
.
log
(
"Withdrawal Error:"
,
e
);
dispatch
(
dispatch
(
showToast
({
showToast
({
message
:
e
?.
data
?.
message
||
"Something went wrong"
,
message
:
e
?.
data
?.
message
||
"Something went wrong"
,
...
@@ -179,7 +178,6 @@ export default function WithdrawlPage({
...
@@ -179,7 +178,6 @@ export default function WithdrawlPage({
}
}
};
};
console
.
log
(
"Formik Errors:"
,
formik
.
values
.
withdrawl_amounts
);
return
(
return
(
<
section
className=
"withdrawl__root"
>
<
section
className=
"withdrawl__root"
>
<
div
className=
"section__title mb-4 lg:mb-8 max-w-[560px]"
>
<
div
className=
"section__title mb-4 lg:mb-8 max-w-[560px]"
>
...
...
src/routes/ProtectedLink.tsx
View file @
b0a9a158
...
@@ -21,7 +21,6 @@ export default function ProtectedLink({ href, className, children, target, rel,
...
@@ -21,7 +21,6 @@ export default function ProtectedLink({ href, className, children, target, rel,
const
{
data
}
=
useGetGamesPasswordStatusQuery
({
provider
:
provider
||
""
},
{
skip
:
!
provider
});
const
{
data
}
=
useGetGamesPasswordStatusQuery
({
provider
:
provider
||
""
},
{
skip
:
!
provider
});
console
.
log
(
"user data"
,
{
data
,
provider
});
const
handleClick
=
(
e
:
React
.
MouseEvent
)
=>
{
const
handleClick
=
(
e
:
React
.
MouseEvent
)
=>
{
if
(
!
user
)
{
if
(
!
user
)
{
...
...
src/services/baseQuery.ts
View file @
b0a9a158
...
@@ -3,28 +3,43 @@ import { RootState } from "@/hooks/store";
...
@@ -3,28 +3,43 @@ import { RootState } from "@/hooks/store";
import
{
fetchBaseQuery
}
from
"@reduxjs/toolkit/query/react"
;
import
{
fetchBaseQuery
}
from
"@reduxjs/toolkit/query/react"
;
let
globalDeviceId
:
string
|
undefined
=
undefined
;
let
globalDeviceId
:
string
|
undefined
=
undefined
;
let
globalDeviceFingerprint
:
string
|
undefined
=
undefined
;
let
resolveFingerprint
:
(()
=>
void
)
|
undefined
;
const
fingerprintReady
=
new
Promise
<
void
>
((
resolve
)
=>
{
resolveFingerprint
=
resolve
;
});
// Safety timeout — never block forever
const
fingerprintTimeout
=
setTimeout
(()
=>
resolveFingerprint
?.(),
4000
);
export
const
setGlobalDeviceId
=
(
id
?:
string
)
=>
{
export
const
setGlobalDeviceId
=
(
id
?:
string
)
=>
{
globalDeviceId
=
id
;
globalDeviceId
=
id
;
};
};
export
const
baseQuery
=
fetchBaseQuery
({
baseUrl
:
(
process
.
env
.
NEXT_PUBLIC_FRONTEND_URL
||
""
)
+
"/api/backend"
,
export
const
setGlobalDeviceFingerprint
=
(
fingerprint
?:
string
)
=>
{
globalDeviceFingerprint
=
fingerprint
;
clearTimeout
(
fingerprintTimeout
);
resolveFingerprint
?.();
};
const
base
=
fetchBaseQuery
({
baseUrl
:
(
process
.
env
.
NEXT_PUBLIC_FRONTEND_URL
||
""
)
+
"/api/backend"
,
credentials
:
"include"
,
credentials
:
"include"
,
prepareHeaders
:
(
headers
,
{
getState
})
=>
{
prepareHeaders
:
(
headers
,
{
getState
})
=>
{
const
token
=
(
getState
()
as
RootState
).
auth
.
access_token
;
const
token
=
(
getState
()
as
RootState
).
auth
.
access_token
;
headers
.
set
(
"Accept"
,
"application/json"
);
headers
.
set
(
"Accept"
,
"application/json"
);
if
(
globalDeviceId
)
{
if
(
globalDeviceId
)
headers
.
set
(
"X-Device-Id"
,
globalDeviceId
);
headers
.
set
(
"X-Device-Id"
,
globalDeviceId
);
if
(
globalDeviceFingerprint
)
headers
.
set
(
"X-Device-Fingerprint"
,
globalDeviceFingerprint
);
}
if
(
token
)
headers
.
set
(
"Authorization"
,
`Bearer
${
token
}
`
);
if
(
token
)
{
headers
.
set
(
"Authorization"
,
`Bearer
${
token
}
`
);
}
return
headers
;
return
headers
;
},
},
});
});
export
const
baseQuery
:
ReturnType
<
typeof
fetchBaseQuery
>
=
async
(
queryArg
,
api
,
extraOptions
)
=>
{
await
fingerprintReady
;
return
base
(
queryArg
,
api
,
extraOptions
);
};
\ No newline at end of file
src/theme/index.tsx
View file @
b0a9a158
...
@@ -11,7 +11,7 @@ import Palette from './palette';
...
@@ -11,7 +11,7 @@ import Palette from './palette';
export
default
function
ThemeCustomization
({
children
}:
{
children
:
React
.
ReactNode
})
{
export
default
function
ThemeCustomization
({
children
}:
{
children
:
React
.
ReactNode
})
{
const
[
theme
,
setTheme
]
=
React
.
useState
(
ThemeMode
.
DARK
);
const
[
_
theme
,
setTheme
]
=
React
.
useState
(
ThemeMode
.
DARK
);
const
user
=
useAppSelector
((
state
)
=>
state
.
auth
.
user
);
const
user
=
useAppSelector
((
state
)
=>
state
.
auth
.
user
);
const
globalStyles
=
{
const
globalStyles
=
{
...
@@ -33,7 +33,6 @@ export default function ThemeCustomization({ children }: { children: React.React
...
@@ -33,7 +33,6 @@ export default function ThemeCustomization({ children }: { children: React.React
},
[
user
]);
},
[
user
]);
console
.
log
(
theme
)
return
(
return
(
<
StyledEngineProvider
injectFirst
>
<
StyledEngineProvider
injectFirst
>
<
NextAppDirEmotionCacheProvider
options=
{
{
key
:
'mui'
}
}
>
<
NextAppDirEmotionCacheProvider
options=
{
{
key
:
'mui'
}
}
>
...
...
src/utils/authSession.ts
View file @
b0a9a158
...
@@ -64,7 +64,6 @@ export function backupAuthToCookies(): void {
...
@@ -64,7 +64,6 @@ export function backupAuthToCookies(): void {
});
});
sessionStorage
.
setItem
(
TIMESTAMP_KEY
,
timestamp
.
toString
());
sessionStorage
.
setItem
(
TIMESTAMP_KEY
,
timestamp
.
toString
());
console
.
log
(
'[Auth] Backed up auth data to cookies and sessionStorage'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'[Auth] Failed to backup auth data:'
,
error
);
console
.
error
(
'[Auth] Failed to backup auth data:'
,
error
);
}
}
...
@@ -88,7 +87,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
...
@@ -88,7 +87,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
const
sessionUser
=
sessionStorage
.
getItem
(
`
${
SESSION_BACKUP_PREFIX
}
user`
);
const
sessionUser
=
sessionStorage
.
getItem
(
`
${
SESSION_BACKUP_PREFIX
}
user`
);
if
(
sessionAccessToken
&&
sessionUser
)
{
if
(
sessionAccessToken
&&
sessionUser
)
{
console
.
log
(
'[Auth] Restoring from sessionStorage'
);
const
userData
=
JSON
.
parse
(
sessionUser
);
const
userData
=
JSON
.
parse
(
sessionUser
);
const
authData
:
AuthData
=
{
const
authData
:
AuthData
=
{
access_token
:
sessionAccessToken
,
access_token
:
sessionAccessToken
,
...
@@ -108,7 +106,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
...
@@ -108,7 +106,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
// Try cookies (cross-tab scenario from payment provider)
// Try cookies (cross-tab scenario from payment provider)
const
wasRedirected
=
Cookies
.
get
(
`
${
BACKUP_PREFIX
}
redirected`
);
const
wasRedirected
=
Cookies
.
get
(
`
${
BACKUP_PREFIX
}
redirected`
);
if
(
!
wasRedirected
)
{
if
(
!
wasRedirected
)
{
console
.
log
(
'[Auth] No redirect marker found'
);
return
{
success
:
false
,
source
:
'none'
,
data
:
null
};
return
{
success
:
false
,
source
:
'none'
,
data
:
null
};
}
}
...
@@ -117,7 +114,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
...
@@ -117,7 +114,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
const
cookieUser
=
Cookies
.
get
(
`
${
BACKUP_PREFIX
}
user`
);
const
cookieUser
=
Cookies
.
get
(
`
${
BACKUP_PREFIX
}
user`
);
if
(
cookieAccessToken
&&
cookieUser
)
{
if
(
cookieAccessToken
&&
cookieUser
)
{
console
.
log
(
'[Auth] Restoring from cookies'
);
const
userData
=
JSON
.
parse
(
cookieUser
);
const
userData
=
JSON
.
parse
(
cookieUser
);
const
authData
:
AuthData
=
{
const
authData
:
AuthData
=
{
access_token
:
cookieAccessToken
,
access_token
:
cookieAccessToken
,
...
@@ -138,7 +134,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
...
@@ -138,7 +134,6 @@ export function restoreAuthFromCookies(): AuthRestorationResult {
return
{
success
:
true
,
source
:
'cookies'
,
data
:
authData
};
return
{
success
:
true
,
source
:
'cookies'
,
data
:
authData
};
}
}
console
.
log
(
'[Auth] No valid backup found in cookies or sessionStorage'
);
return
{
success
:
false
,
source
:
'none'
,
data
:
null
};
return
{
success
:
false
,
source
:
'none'
,
data
:
null
};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'[Auth] Failed to restore auth data:'
,
error
);
console
.
error
(
'[Auth] Failed to restore auth data:'
,
error
);
...
@@ -156,7 +151,6 @@ function cleanupAuthCookies(): void {
...
@@ -156,7 +151,6 @@ function cleanupAuthCookies(): void {
Cookies
.
remove
(
`
${
BACKUP_PREFIX
}${
key
}
`
);
Cookies
.
remove
(
`
${
BACKUP_PREFIX
}${
key
}
`
);
});
});
Cookies
.
remove
(
`
${
BACKUP_PREFIX
}
redirected`
);
Cookies
.
remove
(
`
${
BACKUP_PREFIX
}
redirected`
);
console
.
log
(
'[Auth] Cleaned up backup cookies'
);
}
}
/**
/**
...
@@ -169,7 +163,6 @@ function cleanupAuthSessionStorage(): void {
...
@@ -169,7 +163,6 @@ function cleanupAuthSessionStorage(): void {
sessionStorage
.
removeItem
(
`
${
SESSION_BACKUP_PREFIX
}${
key
}
`
);
sessionStorage
.
removeItem
(
`
${
SESSION_BACKUP_PREFIX
}${
key
}
`
);
});
});
sessionStorage
.
removeItem
(
TIMESTAMP_KEY
);
sessionStorage
.
removeItem
(
TIMESTAMP_KEY
);
console
.
log
(
'[Auth] Cleaned up sessionStorage backup'
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment