1.0.12 • Published 5 years ago

react-simple-cookie-store v1.0.12

Weekly downloads
66
License
MIT
Repository
github
Last release
5 years ago

React Simple Cookie Store

A dead simple interface for storing cookies. Built on top of universal-cookies and luxon. Automatically sets cookies as secure provided the user is browsing via HTTPS. To illustrate usage, check out this simple example storing an access token:

import { setCookie, getCookie, removeCookie } from "react-simple-cookie-store"

// Do some work...
async function login(email,password) {
    let token = await authenticate(username,password)
    // Sets a cookie to store some value (i.e. accessToken) which will be valid for 2 days.
    setCookie("token", token, 2)
}

// Retrieves the stored accessToken.
function currentUser() {
    return getCookie("token")
}

// Clear the cookie storing the current user's access token.
function logout() {
    removeCookie("token")
}
1.0.12

5 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago