Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use WebStorage API for internal data #22

Open
maximousblk opened this issue May 12, 2021 · 0 comments
Open

feat: use WebStorage API for internal data #22

maximousblk opened this issue May 12, 2021 · 0 comments
Assignees
Labels
feature request New feature request
Milestone

Comments

@maximousblk
Copy link
Member

maximousblk commented May 12, 2021

🚀 Feature

All the info that should not be view or edited by the user should be stored in localstorage.

Motivation

Deno added support for WebStorage API

blog post: https://deno.com/blog/v1.10#support-for-web-storage-api

This would also make the code a bit cleaner since we won't have to poke the environment variables to find the home directory just to get the user's access token.

pr: denoland/deno#7819

Implementation

The user would define the location during install like so:

deno install -qA --unstable --location https://nest.land https://nest.land/-/nest/nest.ts

and used like so:

// Add new user (nest login)
addUser(username: string, token: string) {
  const users: Users = JSON.parse(localStorage.getItem('users'));
	  
  users[username] = { token }

  localStorage.setItem('users', JSON.stringify(users);
}

addUser('maximousblk', 'NEST_6FF4C8F4374F46C5A5928AFE85C2354EA37AED00')


// Change active user (nest switch)
setActiveUser(username: string) {
  localStorage.setItem('activeUser', username);
}

setActiveUser('maximousblk')

Alternatives

n/a

Additional context

n/a

@maximousblk maximousblk added the feature request New feature request label May 12, 2021
@maximousblk maximousblk added this to the MVP 1 milestone May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request
Projects
None yet
Development

No branches or pull requests

2 participants