Started with the login function and it works more or less :-)
This commit is contained in:
parent
8e77306c93
commit
8d4d166924
8 changed files with 300 additions and 58 deletions
11
frontend/src/auth/AuthProvider.js
Normal file
11
frontend/src/auth/AuthProvider.js
Normal 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())
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue