refactor: migrate to jwt sessions instead of store sessions

This commit is contained in:
MTG2000
2022-06-09 12:28:34 +03:00
parent d8fd6e1432
commit 435fc7f844
14 changed files with 257 additions and 234 deletions

View File

@@ -9,6 +9,7 @@ import LoadingPage from "./Components/LoadingPage/LoadingPage";
import { useMeQuery } from "./graphql";
import { setUser } from "./redux/features/user.slice";
import ProtectedRoute from "./Components/ProtectedRoute/ProtectedRoute";
import { Helmet } from "react-helmet";
// Pages
const FeedPage = React.lazy(() => import("./features/Posts/pages/FeedPage/FeedPage"))
@@ -62,6 +63,19 @@ function App() {
return <div id="app" className='w-full'>
<Helmet>
<title >makers.bolt.fun</title>
<meta
name="description"
content="A lightning app directory made for and by the bitcoin community."
/>
<meta
property="og:title"
content="makers.bolt.fun"
/>
</Helmet>
<Navbar />
<Suspense fallback={<LoadingPage />}>
<Routes>

View File

@@ -57,7 +57,18 @@ export default function LoginPage() {
}, [])
const startPolling = () => {
meQuery.startPolling(3000)
// meQuery.startPolling(3000)
const interval = setInterval(() => {
fetch(CONSTS.apiEndpoint + '/is-logged-in', {
credentials: 'include'
}).then(data => data.json())
.then(data => {
if (data.logged_in) {
clearInterval(interval)
meQuery.refetch();
}
})
}, 2000)
}