mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use new session and auth provider for the frontend
This commit is contained in:
parent
d939dc16eb
commit
6aa849b305
27 changed files with 283 additions and 235 deletions
|
|
@ -45,6 +45,22 @@ export async function getUserInfo(token: string): Promise<any> {
|
|||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getUserSession(token: string): Promise<any> {
|
||||
const origin = window.location.origin;
|
||||
const HeadersConfig = new Headers({ Authorization: `Bearer ${token}`, Origin: origin });
|
||||
|
||||
const requestOptions: any = {
|
||||
method: "GET",
|
||||
headers: HeadersConfig,
|
||||
redirect: "follow",
|
||||
credentials: "include",
|
||||
};
|
||||
|
||||
return fetch(`${getAPIUrl()}users/session`, requestOptions)
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getNewAccessTokenUsingRefreshToken(): Promise<any> {
|
||||
const requestOptions: any = {
|
||||
method: "POST",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue