File tree 2 files changed +29
-13
lines changed
2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -262,15 +262,11 @@ export async function updateCustomerBillingAddress(
262
262
}
263
263
}
264
264
265
- export async function signOut ( ) {
265
+ export async function signOut ( countryCode : string ) {
266
266
cookies ( ) . set ( "_medusa_jwt" , "" , {
267
267
maxAge : - 1 ,
268
268
} )
269
- const nextUrl = headers ( ) . get ( "next-url" )
270
- const countryCode = nextUrl ?. split ( "/" ) [ 1 ] || ""
271
269
revalidateTag ( "auth" )
272
270
revalidateTag ( "customer" )
273
- if ( nextUrl ) {
274
- redirect ( `/${ countryCode } /account` )
275
- }
271
+ redirect ( `/${ countryCode } /account` )
276
272
}
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ const AccountNav = ({
18
18
customer : Omit < Customer , "password_hash" > | null
19
19
} ) => {
20
20
const route = usePathname ( )
21
- const { countryCode } = useParams ( )
21
+ const { countryCode } = useParams ( ) as { countryCode : string }
22
22
23
23
const handleLogout = async ( ) => {
24
- await signOut ( )
24
+ await signOut ( countryCode )
25
25
}
26
26
27
27
return (
@@ -114,27 +114,47 @@ const AccountNav = ({
114
114
< div className = "text-base-regular" >
115
115
< ul className = "flex mb-0 justify-start items-start flex-col gap-y-4" >
116
116
< li >
117
- < AccountNavLink href = "/account" route = { route ! } data-testid = "overview-link" >
117
+ < AccountNavLink
118
+ href = "/account"
119
+ route = { route ! }
120
+ data-testid = "overview-link"
121
+ >
118
122
Overview
119
123
</ AccountNavLink >
120
124
</ li >
121
125
< li >
122
- < AccountNavLink href = "/account/profile" route = { route ! } data-testid = "profile-link" >
126
+ < AccountNavLink
127
+ href = "/account/profile"
128
+ route = { route ! }
129
+ data-testid = "profile-link"
130
+ >
123
131
Profile
124
132
</ AccountNavLink >
125
133
</ li >
126
134
< li >
127
- < AccountNavLink href = "/account/addresses" route = { route ! } data-testid = "addresses-link" >
135
+ < AccountNavLink
136
+ href = "/account/addresses"
137
+ route = { route ! }
138
+ data-testid = "addresses-link"
139
+ >
128
140
Addresses
129
141
</ AccountNavLink >
130
142
</ li >
131
143
< li >
132
- < AccountNavLink href = "/account/orders" route = { route ! } data-testid = "orders-link" >
144
+ < AccountNavLink
145
+ href = "/account/orders"
146
+ route = { route ! }
147
+ data-testid = "orders-link"
148
+ >
133
149
Orders
134
150
</ AccountNavLink >
135
151
</ li >
136
152
< li className = "text-grey-700" >
137
- < button type = "button" onClick = { handleLogout } data-testid = "logout-button" >
153
+ < button
154
+ type = "button"
155
+ onClick = { handleLogout }
156
+ data-testid = "logout-button"
157
+ >
138
158
Log out
139
159
</ button >
140
160
</ li >
You can’t perform that action at this time.
0 commit comments