Web: People: clear banner db

This commit is contained in:
Viktor Fomin 2022-01-19 14:17:35 +03:00
parent 17a06e66f2
commit ed2dc40778

View File

@ -17,6 +17,10 @@ import { combineUrl } from "@appserver/common/utils";
import withCultureNames from "@appserver/common/hoc/withCultureNames"; import withCultureNames from "@appserver/common/hoc/withCultureNames";
import config from "../../../../../../package.json"; import config from "../../../../../../package.json";
import NoUserSelect from "@appserver/components/utils/commonStyles"; import NoUserSelect from "@appserver/components/utils/commonStyles";
import { DBConfig } from "@appserver/common/utils/AdsDBConfig";
import { initDB, useIndexedDB } from "react-indexed-db";
initDB(DBConfig);
const InfoContainer = styled.div` const InfoContainer = styled.div`
margin-bottom: 24px; margin-bottom: 24px;
@ -168,6 +172,7 @@ class ProfileInfo extends React.PureComponent {
//i18n, //i18n,
setIsLoading, setIsLoading,
} = this.props; } = this.props;
const { clear } = useIndexedDB("ads");
if (profile.cultureName === language.key) return; if (profile.cultureName === language.key) return;
@ -177,7 +182,12 @@ class ProfileInfo extends React.PureComponent {
// console.log("changeLanguage to", language.key); // console.log("changeLanguage to", language.key);
// i18n && i18n.changeLanguage(language.key); // i18n && i18n.changeLanguage(language.key);
// }) // })
.then(() => setIsLoading(false)) .then(() => {
setIsLoading(false);
clear().then(() => {
console.log("db clear!");
});
})
.then(() => location.reload()) .then(() => location.reload())
.catch((error) => { .catch((error) => {
toastr.error(error && error.message ? error.message : error); toastr.error(error && error.message ? error.message : error);