Skip to content

Commit

Permalink
Merge pull request #584 from systemli/dependabot/npm_and_yarn/jwt-dec…
Browse files Browse the repository at this point in the history
…ode-4.0.0

Bump jwt-decode from 3.1.2 to 4.0.0
  • Loading branch information
0x46616c6b authored Jan 1, 2024
2 parents 81fa140 + 759a659 commit e9d980e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@mui/material": "^5.14.11",
"@tanstack/react-query": "^4.10.3",
"@tanstack/react-query-devtools": "^4.11.0",
"jwt-decode": "^3.1.2",
"jwt-decode": "^4.0.0",
"leaflet": "^1.9.2",
"leaflet-draw": "^1.0.4",
"lodash": "^4.17.21",
Expand Down
6 changes: 3 additions & 3 deletions src/components/useAuth.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useState } from 'react'
import { login as loginApi } from '../api/Auth'
import { useLocation, useNavigate } from 'react-router'
import decode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'

export type Roles = 'user' | 'admin'

Expand Down Expand Up @@ -45,7 +45,7 @@ export function AuthProvider({ children }: { children: ReactNode }): JSX.Element

let user: User
try {
user = decode(token) as User
user = jwtDecode(token) as User
} catch (error) {
setError(error as Error)
setLoadingInitial(false)
Expand All @@ -70,7 +70,7 @@ export function AuthProvider({ children }: { children: ReactNode }): JSX.Element
localStorage.setItem('token', response.token)
setToken(response.token)

const user = decode(response.token) as User
const user = jwtDecode(response.token) as User
setUser(user)
navigate('/')
})
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6724,10 +6724,10 @@ jsonfile@^6.0.1:
object.assign "^4.1.4"
object.values "^1.1.6"

jwt-decode@*, jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
jwt-decode@*, jwt-decode@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-4.0.0.tgz#2270352425fd413785b2faf11f6e755c5151bd4b"
integrity sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==

jwt-encode@^1.0.1:
version "1.0.1"
Expand Down

0 comments on commit e9d980e

Please sign in to comment.