-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): improve cleeng session stablity
- Loading branch information
1 parent
79b6fc7
commit 245c0f8
Showing
24 changed files
with
906 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { useAccountStore } from '#src/stores/AccountStore'; | ||
import type { AuthData, Customer, CustomerConsent } from '#types/account'; | ||
import type { Customer, CustomerConsent } from '#types/account'; | ||
|
||
function useAccount<T>(callback: (args: { customerId: string; customer: Customer; customerConsents: CustomerConsent[] | null; auth: AuthData }) => T): T { | ||
const { user, auth, customerConsents } = useAccountStore.getState(); | ||
function useAccount<T>(callback: (args: { customerId: string; customer: Customer; customerConsents: CustomerConsent[] | null }) => T): T { | ||
const { user, customerConsents } = useAccountStore.getState(); | ||
|
||
if (!user?.id || !auth?.jwt) throw new Error('user not logged in'); | ||
if (!user?.id) throw new Error('user not logged in'); | ||
|
||
return callback({ customerId: user.id, customer: user, auth, customerConsents }); | ||
return callback({ customerId: user.id, customer: user, customerConsents }); | ||
} | ||
|
||
export default useAccount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.