renew-session

This commit is contained in:
tonyrewin 2022-09-09 17:13:50 +03:00
parent 3116af0ec9
commit fe88d3e150
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { isServer, Show } from 'solid-js/web'
import { Show } from 'solid-js/web'
import Icon from './Icon'
import { createEffect, createSignal, onMount } from 'solid-js'
import './AuthModal.scss'
@ -6,7 +6,7 @@ import { Form } from 'solid-js-form'
import { t } from '../../utils/intl'
import { hideModal, useModalStore } from '../../stores/ui'
import { useStore } from '@nanostores/solid'
import { session as sessionstore, signIn, updateSession } from '../../stores/auth'
import { session as sessionstore, signIn, renewSession } from '../../stores/auth'
import { apiClient } from '../../utils/apiClient'
import { useValidator } from '../../utils/validators'

View File

@ -50,3 +50,9 @@ export const signResetConfirm = action(session, 'signResetConfirm', async (store
setToken(auth.token)
store.set(auth)
})
export const renewSession = action(session, 'renewSession', async (store) => {
const s = await apiClient.getSession() // token in header
setToken(s.token)
store.set(s)
})