fix(editor): Handle null object on saving user settings (no-changelog) (#6341)

deal with null settings
This commit is contained in:
Michael Auerswald 2023-06-05 13:41:59 +02:00 committed by GitHub
parent f5ac3f4fa9
commit 3b1a2f88b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,7 +187,10 @@ export default defineComponent({
},
async onAllowSSOManualLogin(userId: string) {
const user = this.usersStore.getUserById(userId) as IUser | null;
if (user?.settings) {
if (user) {
if (!user.settings) {
user.settings = {};
}
user.settings.allowSSOManualLogin = true;
await this.usersStore.updateOtherUserSettings(userId, user.settings);