Started with the login function and it works more or less :-)

This commit is contained in:
cami 2021-06-22 03:41:14 +02:00
parent 8e77306c93
commit 8d4d166924
8 changed files with 300 additions and 58 deletions

View file

@ -0,0 +1,11 @@
import { createAuthProvider } from "react-token-auth";
export const [useAuth, authFetch, login, logout] =
createAuthProvider({
accessTokenKey: 'access_token',
onUpdateToken: (token) => fetch('/api/refresh', {
method: 'POST',
body: token.access_token
})
.then(r => r.json())
})