'Setting default cookies in Nuxt and editing them at will

I am new to using cookies in NUXT, I want to save user preferences using cookies on next, and if they want to allow analytics to run or not.

For that, I want that by default each user's cookies have these values

{
    showAgain: true,
    analytics: false
}

and I would like to be able to manipulate their values at will.

From what I have also read online, I see that people are saying that in NuxtJs if I am using cookies, I also have to use local storage.

Please, can anyone direct me on how to go about solving the issues?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source