mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Set the expire date of the cookie's token to one date
This commit is contained in:
@@ -252,8 +252,14 @@ export class AuthService {
|
|||||||
* @returns {AuthTokenInfo}
|
* @returns {AuthTokenInfo}
|
||||||
*/
|
*/
|
||||||
public storeToken(token: AuthTokenInfo) {
|
public storeToken(token: AuthTokenInfo) {
|
||||||
const expires = new Date(token.expires);
|
// Add 1 day to the current date
|
||||||
|
const expireDate = Date.now() + (1000 * 60 * 60 * 24 * 1);
|
||||||
|
|
||||||
|
// Set the cookie expire date
|
||||||
|
const expires = new Date(expireDate);
|
||||||
const options: CookieAttributes = {expires: expires};
|
const options: CookieAttributes = {expires: expires};
|
||||||
|
|
||||||
|
// Save cookie with the token
|
||||||
return this.storage.set(TOKENITEM, token, options);
|
return this.storage.set(TOKENITEM, token, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user