forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix UserNameDialog open error and add defensive ref check
- Added ref="userNameDialog" to UserNameDialog in AccountViewView.vue template - Patched onEditName() to check for dialog ref and open() method before calling - Improved error notification to use NotificationIface fields (group, type, title, text) - Prevents "Cannot read properties of undefined (reading 'open')" error if dialog is missing
This commit is contained in:
@@ -260,12 +260,16 @@
|
||||
<h3
|
||||
id="advanced"
|
||||
class="text-blue-500 text-sm font-semibold mb-3 cursor-pointer"
|
||||
@click="showAdvanced = !showAdvanced"
|
||||
@click="toggleShowGeneralAdvanced"
|
||||
>
|
||||
{{ showAdvanced ? "Hide Advanced Settings" : "Show Advanced Settings" }}
|
||||
{{
|
||||
showGeneralAdvanced
|
||||
? "Hide Advanced Settings"
|
||||
: "Show Advanced Settings"
|
||||
}}
|
||||
</h3>
|
||||
<section
|
||||
v-if="showAdvanced || showGeneralAdvanced"
|
||||
v-if="showGeneralAdvanced"
|
||||
id="sectionAdvanced"
|
||||
aria-labelledby="advancedHeading"
|
||||
>
|
||||
@@ -740,6 +744,8 @@
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<UserNameDialog ref="userNameDialog" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -1595,11 +1601,20 @@ export default class AccountViewView extends Vue {
|
||||
|
||||
// IdentitySection event handlers
|
||||
onEditName() {
|
||||
(this.$refs.userNameDialog as InstanceType<typeof UserNameDialog>).open(
|
||||
(name?: string) => {
|
||||
const dialog = this.$refs.userNameDialog as any;
|
||||
if (dialog && typeof dialog.open === "function") {
|
||||
dialog.open((name?: string) => {
|
||||
if (name) this.givenName = name;
|
||||
},
|
||||
);
|
||||
});
|
||||
} else {
|
||||
this.$notify?.({
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Dialog Error",
|
||||
text: "Name dialog not available.",
|
||||
});
|
||||
console.error("UserNameDialog ref is missing or open() is not a function", dialog);
|
||||
}
|
||||
}
|
||||
onShowQrCode() {
|
||||
this.handleQRCodeClick();
|
||||
|
||||
Reference in New Issue
Block a user