fix(settings): use user context for org id instead of local storage token
This commit is contained in:
@@ -57,15 +57,7 @@ export default function OrganizationSettings() {
|
|||||||
const [isSaving, setIsSaving] = useState(false)
|
const [isSaving, setIsSaving] = useState(false)
|
||||||
|
|
||||||
const getOrgIdFromToken = () => {
|
const getOrgIdFromToken = () => {
|
||||||
if (typeof window === 'undefined') return null
|
return user?.org_id || null
|
||||||
const token = localStorage.getItem('token')
|
|
||||||
if (!token) return null
|
|
||||||
try {
|
|
||||||
const payload = JSON.parse(atob(token.split('.')[1]))
|
|
||||||
return payload.org_id || null
|
|
||||||
} catch (e) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentOrgId = getOrgIdFromToken()
|
const currentOrgId = getOrgIdFromToken()
|
||||||
|
|||||||
Reference in New Issue
Block a user