10 lines
306 B
JavaScript
10 lines
306 B
JavaScript
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()),
|
|
});
|