Skip to content

Commit 3b5d4d6

Browse files
ficastFilipe de Castro Oliveira
andauthored
Fix redirectTo after unnecessary change (#34)
Co-authored-by: Filipe de Castro Oliveira <[email protected]>
1 parent f8ea086 commit 3b5d4d6

File tree

5 files changed

+10
-20
lines changed

5 files changed

+10
-20
lines changed

.changeset/slimy-rats-smoke.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/core/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# @baseapp-frontend/core
22

3+
## 2.5.2
4+
5+
### Patch Changes
6+
7+
- Fix redirectTo after unnecessary change
8+
39
## 2.5.1
410

511
### Minor Changes
612

7-
- bde037a: Adding cammelcase on axios error responses and option to send query param to the redirectTo route on useUser
13+
- Adding cammelcase on axios error responses and option to send query param to the redirectTo route on useUser
814

915
## 2.4.1
1016

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@baseapp-frontend/core",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "Core utilities.",
55
"main": "./src/index.tsx",
66
"scripts": {

packages/core/src/auth/login.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ import type {
2121
ILoginMfaRequest,
2222
ILoginMfaResponse,
2323
ILoginResponse,
24-
IUseUser,
2524
IUserContext,
2625
LoginRequiredServerSideProps,
2726
} from './types'
2827

2928
export function useUser({
3029
redirectTo = '',
3130
redirectIfFound = false,
32-
query = {},
33-
}: IUseUser = {}): IUserContext {
31+
} = {}): IUserContext {
3432
const router = useRouter()
3533
const { user, isLoading, isSuccess, isIdle, status, setUser, refetchUser } = useUserContext()
3634

@@ -45,10 +43,7 @@ export function useUser({
4543
// If redirectIfFound is also set, redirect if the user was found
4644
(redirectIfFound && user)
4745
) {
48-
router.push({
49-
pathname: redirectTo,
50-
query,
51-
})
46+
router.push(redirectTo)
5247
}
5348
}, [user, redirectIfFound, redirectTo, isLoading])
5449

packages/core/src/auth/types.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ export interface IResetPassword {
8484
mutation: UseMutationResult<unknown, unknown, void, unknown>
8585
}
8686

87-
export interface IUseUser {
88-
redirectTo?: string
89-
redirectIfFound?: boolean
90-
query?: Record<string, string>
91-
}
92-
9387
export interface IUserContext {
9488
user: IUser | null
9589
isLoading: boolean

0 commit comments

Comments
 (0)