fix notifications page on unauthed app (#7226)
This commit is contained in:
parent
3a644d7bfc
commit
4bc4a965d9
2 changed files with 23 additions and 20 deletions
|
@ -2183,5 +2183,6 @@
|
||||||
"Creator": "Creator",
|
"Creator": "Creator",
|
||||||
"From comments": "From comments",
|
"From comments": "From comments",
|
||||||
"From search": "From search",
|
"From search": "From search",
|
||||||
|
"Manage tags": "Manage tags",
|
||||||
"--end--": "--end--"
|
"--end--": "--end--"
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,28 +32,30 @@ export default function NotificationSettingsPage(props: Props) {
|
||||||
const lbryIoParams = verificationToken ? { auth_token: verificationToken } : undefined;
|
const lbryIoParams = verificationToken ? { auth_token: verificationToken } : undefined;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
Lbryio.call('tag', 'list', lbryIoParams)
|
if (isAuthenticated) {
|
||||||
.then(setTags)
|
Lbryio.call('tag', 'list', lbryIoParams)
|
||||||
.catch((e) => {
|
.then(setTags)
|
||||||
setError(true);
|
.catch((e) => {
|
||||||
});
|
setError(true);
|
||||||
|
});
|
||||||
|
|
||||||
Lbryio.call('user_email', 'status', lbryIoParams)
|
Lbryio.call('user_email', 'status', lbryIoParams)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const enabledEmails =
|
const enabledEmails =
|
||||||
res.emails &&
|
res.emails &&
|
||||||
Object.keys(res.emails).reduce((acc, email) => {
|
Object.keys(res.emails).reduce((acc, email) => {
|
||||||
const isEnabled = res.emails[email];
|
const isEnabled = res.emails[email];
|
||||||
return [...acc, { email, isEnabled }];
|
return [...acc, { email, isEnabled }];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
setTagMap(res.tags);
|
setTagMap(res.tags);
|
||||||
setEnabledEmails(enabledEmails);
|
setEnabledEmails(enabledEmails);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
setError(true);
|
setError(true);
|
||||||
});
|
});
|
||||||
}, []);
|
}
|
||||||
|
}, [isAuthenticated]);
|
||||||
|
|
||||||
function handleChangeTag(name, newIsEnabled) {
|
function handleChangeTag(name, newIsEnabled) {
|
||||||
const tagParams = newIsEnabled ? { add: name } : { remove: name };
|
const tagParams = newIsEnabled ? { add: name } : { remove: name };
|
||||||
|
|
Loading…
Reference in a new issue