Skip to content

Commit

Permalink
replace uuid with native API
Browse files Browse the repository at this point in the history
  • Loading branch information
camdendotlol committed Aug 6, 2024
1 parent 19cec6a commit 9bfc357
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.
35 changes: 5 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
"bootstrap-icons-vue": "^1.11.3",
"fflate": "^0.8.2",
"topster": "^5.3.0",
"uuid": "^10.0.0",
"vue": "^3.4.33 ",
"vuex": "^4.1.0"
},
"devDependencies": {
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@vitejs/plugin-vue": "^5.0.5",
Expand Down
5 changes: 2 additions & 3 deletions src/helpers/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Functions for dealing with localStorage

import type { OldStoredChart, StoredChart, StoredCharts } from '../types'
import { v4 as uuidv4 } from 'uuid'

export const setActiveChart = (uuid: string) => {
localStorage.setItem('activeChart', uuid)
Expand Down Expand Up @@ -66,7 +65,7 @@ export const findByUuid = (uuid: string) => {
export const appendChart = (newChart: StoredChart, uuid?: string): string => {
const charts = getStoredCharts()

const newUuid = uuid || uuidv4()
const newUuid = uuid || crypto.randomUUID()

charts[newUuid] = newChart

Expand All @@ -90,7 +89,7 @@ export const localStorageMigrations = () => {
let activeUuid = null

charts.forEach(chart => {
const uuid = uuidv4()
const uuid = crypto.randomUUID()
newObj[uuid] = {
timestamp: chart.timestamp,
data: chart.data
Expand Down

0 comments on commit 9bfc357

Please sign in to comment.