cookie sso
This commit is contained in:
parent
75fa420862
commit
ee2610fa54
4 changed files with 11 additions and 6 deletions
|
|
@ -10,8 +10,9 @@ interface AuthResponse {
|
|||
|
||||
const authenticated = async () => ((await getToken()) ? true : false);
|
||||
|
||||
async function setAuthen(r: AuthResponse) {
|
||||
async function setAuthen(r: AuthResponse, val: string) {
|
||||
await setCookie(ACCESS_TOKEN, r.access_token, r.expires_in);
|
||||
setCookie("SSO", val, r.expires_in);
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
|
|
@ -70,4 +71,4 @@ async function tokenParsed() {
|
|||
return JSON.parse(jsonPayload);
|
||||
}
|
||||
|
||||
export { getToken, authenticated, logout, setAuthen, tokenParsed };
|
||||
export { getToken, authenticated, logout, setAuthen, tokenParsed, getCookie };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue