get-author-fix
This commit is contained in:
parent
45a5f0c542
commit
59eb0265bf
|
@ -19,8 +19,7 @@
|
|||
"lint:styles": "stylelint **/*.{scss,css}",
|
||||
"lint:styles:fix": "stylelint **/*.{scss,css} --fix",
|
||||
"pre-commit": "lint-staged",
|
||||
"pre-push": "",
|
||||
"pre-push-old": "npm run typecheck",
|
||||
"pre-push": "npm run typecheck",
|
||||
"prepare": "husky install",
|
||||
"preview": "vite preview",
|
||||
"start": "vite",
|
||||
|
|
|
@ -12,10 +12,14 @@ type Props = {
|
|||
}
|
||||
|
||||
export const AuthGuard = (props: Props) => {
|
||||
const { isAuthenticated, isSessionLoaded } = useSession()
|
||||
const {
|
||||
isAuthenticated,
|
||||
isSessionLoaded,
|
||||
actions: { loadSession },
|
||||
} = useSession()
|
||||
const { changeSearchParams } = useRouter<RootSearchParams & AuthModalSearchParams>()
|
||||
|
||||
createEffect(() => {
|
||||
createEffect(async () => {
|
||||
if (props.disabled) {
|
||||
return
|
||||
}
|
||||
|
@ -31,6 +35,8 @@ export const AuthGuard = (props: Props) => {
|
|||
true,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
await loadSession()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ export const SessionProvider = (props: {
|
|||
const [author, { refetch: loadAuthor, mutate: setAuthor }] = createResource<Author | null>(
|
||||
async () => {
|
||||
const u = session()?.user
|
||||
return u ? (await apiClient.getAuthorId({ user: u.id })) || null : null
|
||||
return u ? (await apiClient.getAuthorId({ user: u.id.trim() })) || null : null
|
||||
},
|
||||
{
|
||||
ssrLoadFrom: 'initial',
|
||||
|
|
Loading…
Reference in New Issue
Block a user