Setting the expiry time for vue-cookie in hours Would you like to learn

I'm currently using the following code to set a 3-hour expiry for my vue-cookie:

VueCookie.set('S3ID', getS3ID, 3);

However, it seems that this function is actually setting the cookie expiry time as 3 days instead of 3 hours. Can anyone explain why this might be happening?

Answer №1

Give it a shot:

StoreS3ID('S3_ID', fetchS3ID, '3h');

Answer №2

One possible solution is to utilize a Date object:

var expirationTime = new Date(new Date().getTime() + 180 * 60 * 1000);
VueCookie.set('S3ID', getS3ID, {
    expires: expirationTime
});

Answer №3

I've come up with the answer.

VueCookie.set('S3ID', getS3ID, { expires: "3h" });
  

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The chat text will automatically scroll down, displaying information loaded from the database

Is there a way to ensure that chat text always remains scrolled to the bottom of the chat? I have tried multiple tutorials and examples from Stack Overflow, but none seem to work for me. Currently, my chat text overflows the textarea when there are too m ...

Steps for removing an item from an array in MongoDB

Is it possible to remove an object from the mainList array? _id:ObjectId("5fafc5aec2b84c301845c55a"), username:"test", mainList:[ { _id:ObjectId("5fafdf1a5b49510c789af0ae"), n ...

Use an EditText to capture user input, then pass the variables to a Webview by executing a javascript command

I'm currently working on a basic web application that aims to streamline the user experience by eliminating the need for repeated credential input upon website access (without saving passwords). After some exploration, I was able to identify and manip ...

The parameters used in the json.parse function in javascript may be difficult to interpret

Currently, I am examining a JavaScript file on this website. It contains the following code: let source = fs.readFileSync("contracts.json"); let contracts = JSON.parse(source)["contracts"]; I'm curious about what exactly the JSON.parse function is d ...

Do not delay, MongoJS function is ready to go!

I have a function set up in my Express JS endpoint that uses 'await' to retrieve data from a Mongo DB using Mongo JS. Function:- async function getIntroducer(company){ const intro = await dbIntro.collection('introducers').findOne({c ...

Response from Vimeo's AJAX API

I am having trouble retrieving the AJAX response from Vimeo to extract a thumbnail without using JQuery. Even though I can see the response data in JSON format when I type the response query (http://vimeo.com/api/v2/video/30408418.json) into the browser an ...

Express Power Tool - Error: app.set function is undefined

My journey with creating an API using Node/Express began with a solo endeavor to learn the basics in a 'naive' manner. The initial setup worked smoothly, prompting me to experiment with express-generator. Upon completion of the setup process, th ...

Installing Eclipse for PHP and JavaScript on your computer is a simple process. Here

Currently, I am working on a web project that consists mostly of PHP and JavaScript files, as well as some HTML and CSS files. I have decided to use Eclipse as my Integrated Development Environment (IDE) for this project. However, upon visiting eclipse.org ...

Uniform Image Sizes in Bootstrap Carousel (With One Exception)

I am encountering a JavaScript exception related to image size. I am trying to set a fixed size for the images in my carousel, allowing them to auto adjust or resize without concern for distortion or pixelation. I have experimented with max-width and widt ...

Issue with UseState causing a re-render not to be triggered

My orders list state works perfectly on the initial update. However, when an order in the database gets updated, the order list is updated but fails to trigger a re-render even with <...> const [orders, setOrders] = useState([]); useEffect(( ...

Tips for accessing the selected button in notification.confirm() within a PhoneGap app

Recently, I implemented the Phonegap notification.confirm in this way: navigator.notification.confirm( 'Do you wish to proceed?', function() { console.log("Function Called"); }, 'Game Over', 'Continu ...

Issues with tabbed navigation functionality in jQuery

I'm encountering some difficulties with the tabbed navigation I created using CSS. Essentially, when a button is clicked, it should remove the hidden class from one div and add it to the other. However, what actually happens is that the div which sho ...

What is the reason for requiring shaders to reside in an HTML file for a WebGL program?

In a recent forum thread, an individual posed the question about how to eliminate shaders from html. The discussion revolved around finding alternatives to embedding shaders in webGL code: WebGL - is there an alternative to embedding shaders in HTML? The ...

Unable to transfer a function to a component using <Route /> tag

In the Erm component, the function setErm is undefined even though it is received by the App component. When passing something like something='foo', the ERM component receives it but not setErm={props.setErm} const App = props => { console. ...

Can you clarify the distinctions between @nuxtjs/google-gtag, @nuxtjs/gtm, @nuxtjs/google-analytics, and vue-gtag, and which one would be most suitable for GA4

I'm diving into the world of analytics and feeling quite overwhelmed by it all. My goal is to implement Google Analytics 4 in my nuxt SSR webapp, but I'm struggling with the abundance of options available. I came across a dilemma on nuxtjs/goog ...

Load the dropdown menu with JSON data but encounter an error: SyntaxError caused by an unexpected token `{` in

I am currently working on populating a dropdown menu with the values of the 'styleName' field from a JSON data file. Here is an example of my JSON data: {"name":{"styleName":"name","fillType":"none","fillTrans":"0","outlineType":"solid","outlin ...

Instructions on merging elements in an array with identical property values

Consider the array below: [{a:1,b:1},{a:5,b:2},{a:10,b:2},{a:20,b:3}] Is there a way to create a new array that merges elements with the same b value, while adding up the corresponding a values? The desired output should be as follows: [{a:1,b:1},{a:(5+10 ...

How can I position 7 images absolutely within a specific div?

I've been working on a website where users can have their avatars displayed using a JS function that loads 7 different images onto the page. These images correspond to different elements such as skin base, hair, eyes, mouth, shirt, shoes, and pants, a ...

Utilizing unique layouts for specific views in sails.js and angular.js

I am currently working on a Sails.js + Angular.js project with a single layout. However, I have come across different HTML files that have a completely different layout compared to the one I am using. The layout file I am currently using is the default la ...

The IMDB API is throwing a GraphQL error that says, "ClientError: Unable to retrieve information on the field 'Image' for the type 'MainSearchEntity'."

Seeking suggestions for the top 10 movies related to 'Africa' using the IMDB API demo available here. In my query, I am looking for movie id, title, poster image, and filming location. However, I encounter an error message 'ClientError: Ca ...