- const usernameLocalStorage = peertubeLocalStorage.getItem(this.KEYS.USERNAME)
- if (usernameLocalStorage) {
- return new AuthUser(
- {
- id: parseInt(peertubeLocalStorage.getItem(this.KEYS.ID), 10),
- username: peertubeLocalStorage.getItem(this.KEYS.USERNAME),
- email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
- role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
- nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
- webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true',
- autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true',
- videosHistoryEnabled: peertubeLocalStorage.getItem(this.KEYS.VIDEOS_HISTORY_ENABLED) === 'true'
- },
- Tokens.load()
- )
- }
+ const tokens = Tokens.load()
+ if (!tokens) return null
+
+ const userInfo = getUserInfoFromLocalStorage()
+ if (!userInfo) return null