Skip to content

Commit aae157e

Browse files
committed
fix: update the username into slug and redirect
1 parent a1f7610 commit aae157e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/web/components/routes/preferences/preference-section.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function PreferenceSection({ title, items }: PreferenceSectionProps) {
270270

271271
try {
272272
const { username } = inputValue
273-
const slug = currentUser?.slug || session.user?.slug
273+
const slug = toSlug(username)
274274
const email = currentUser?.email
275275

276276
await updateUserDetails(email ?? null, username ?? null, slug ?? null)
@@ -285,6 +285,10 @@ export function PreferenceSection({ title, items }: PreferenceSectionProps) {
285285
},
286286
})
287287

288+
//reidrect to updated profile
289+
290+
window.location.href = `/u/${slug}/s/pref`
291+
288292
customSonner({
289293
type: 'success',
290294
text: 'Profile updated successfully.',

0 commit comments

Comments
 (0)