session-debug-2
This commit is contained in:
parent
3e2fa02605
commit
070cd7ff2f
|
@ -16,6 +16,7 @@ import {
|
||||||
createMemo,
|
createMemo,
|
||||||
createResource,
|
createResource,
|
||||||
createSignal,
|
createSignal,
|
||||||
|
on,
|
||||||
onMount,
|
onMount,
|
||||||
useContext,
|
useContext,
|
||||||
} from 'solid-js'
|
} from 'solid-js'
|
||||||
|
@ -93,7 +94,7 @@ export const SessionProvider = (props: {
|
||||||
const getSession = async (): Promise<AuthToken> => {
|
const getSession = async (): Promise<AuthToken> => {
|
||||||
try {
|
try {
|
||||||
const t = getToken()
|
const t = getToken()
|
||||||
console.debug('[context.session]' + t)
|
console.debug(t)
|
||||||
const authResult = await authorizer().getSession({
|
const authResult = await authorizer().getSession({
|
||||||
Authorization: t,
|
Authorization: t,
|
||||||
})
|
})
|
||||||
|
@ -159,11 +160,15 @@ export const SessionProvider = (props: {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(
|
||||||
if (props.onStateChangeCallback) {
|
on(
|
||||||
|
() => props.onStateChangeCallback,
|
||||||
|
() => {
|
||||||
props.onStateChangeCallback(token())
|
props.onStateChangeCallback(token())
|
||||||
}
|
},
|
||||||
})
|
{ defer: true },
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
const [configuration, setConfig] = createSignal<ConfigType>(config)
|
const [configuration, setConfig] = createSignal<ConfigType>(config)
|
||||||
|
|
||||||
|
@ -174,7 +179,7 @@ export const SessionProvider = (props: {
|
||||||
setConfig({ ...config, ...metaRes, redirectURL: window.location.origin + '/?modal=auth' })
|
setConfig({ ...config, ...metaRes, redirectURL: window.location.origin + '/?modal=auth' })
|
||||||
console.log('[context.session] refreshing session...')
|
console.log('[context.session] refreshing session...')
|
||||||
const s = await getSession()
|
const s = await getSession()
|
||||||
console.log(`[context.session] ${s}`)
|
console.debug(s)
|
||||||
setToken(s)
|
setToken(s)
|
||||||
console.log('[context.session] loading author...')
|
console.log('[context.session] loading author...')
|
||||||
await loadAuthor()
|
await loadAuthor()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user