chore: a bit more planning
This commit is contained in:
@@ -408,16 +408,198 @@ async $accountSettings(did?: string, defaults: Settings = {}): Promise<Settings>
|
||||
- **Impact**: Fallback logic needs to check new table
|
||||
- **Risk**: **MEDIUM** - Invite processing component
|
||||
|
||||
**Current Implementation:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class InviteOneAcceptView extends Vue {
|
||||
activeDid = ""; // Component data
|
||||
|
||||
async mounted() {
|
||||
// Load or generate identity
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
|
||||
// Identity creation should be handled by router guard, but keep as fallback for deep links
|
||||
if (!this.activeDid) {
|
||||
logger.info(
|
||||
"[InviteOneAcceptView] No active DID found, creating identity as fallback",
|
||||
);
|
||||
this.activeDid = await generateSaveAndActivateIdentity();
|
||||
}
|
||||
// ... rest of initialization
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Required Changes:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class InviteOneAcceptView extends Vue {
|
||||
activeDid = ""; // Component data still needed
|
||||
|
||||
async mounted() {
|
||||
// This will automatically work if $accountSettings() is updated
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
|
||||
// Fallback logic remains the same - the API layer handles the new table
|
||||
if (!this.activeDid) {
|
||||
logger.info(
|
||||
"[InviteOneAcceptView] No active DID found, creating identity as fallback",
|
||||
);
|
||||
this.activeDid = await generateSaveAndActivateIdentity();
|
||||
}
|
||||
// ... rest of initialization
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Key Insight**: This component will work automatically since it uses
|
||||
`$accountSettings()`. The fallback logic doesn't need changes.
|
||||
|
||||
2. **`ClaimView.vue`** - Settings retrieval
|
||||
- **Current**: Gets `activeDid` from `$accountSettings()`
|
||||
- **Impact**: Will automatically work if API is updated
|
||||
- **Risk**: **LOW** - Depends on API layer updates
|
||||
|
||||
**Current Implementation:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class ClaimView extends Vue {
|
||||
activeDid = ""; // Component data
|
||||
|
||||
async created() {
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
// ... rest of initialization
|
||||
}
|
||||
|
||||
// Helper method that uses activeDid
|
||||
didInfo(did: string): string {
|
||||
return serverUtil.didInfo(
|
||||
did,
|
||||
this.activeDid, // Uses component data
|
||||
this.allMyDids,
|
||||
this.allContacts,
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Required Changes:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class ClaimView extends Vue {
|
||||
activeDid = ""; // Component data still needed
|
||||
|
||||
async created() {
|
||||
// This will automatically work if $accountSettings() is updated
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
// ... rest of initialization
|
||||
}
|
||||
|
||||
// No changes needed - method will work automatically
|
||||
didInfo(did: string): string {
|
||||
return serverUtil.didInfo(
|
||||
did,
|
||||
this.activeDid, // Uses component data
|
||||
this.allMyDids,
|
||||
this.allContacts,
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Key Insight**: This component requires zero changes since it already
|
||||
uses the proper API method. It's the lowest risk component.
|
||||
|
||||
3. **`ContactAmountsView.vue`** - Direct settings access
|
||||
- **Current**: Accesses `activeDid` directly from settings
|
||||
- **Impact**: Must update to use new API methods
|
||||
- **Risk**: **MEDIUM** - Financial display component
|
||||
|
||||
**Current Implementation:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class ContactAmountsView extends Vue {
|
||||
activeDid = ""; // Component data
|
||||
|
||||
async created() {
|
||||
try {
|
||||
const contactDid = this.$route.query["contactDid"] as string;
|
||||
const contact = await this.$getContact(contactDid);
|
||||
this.contact = contact;
|
||||
|
||||
// Direct access to settings table - this needs to change
|
||||
const settings = await this.$getSettings(MASTER_SETTINGS_KEY);
|
||||
this.activeDid = settings?.activeDid || "";
|
||||
|
||||
if (this.activeDid && this.contact) {
|
||||
this.loadGives(this.activeDid, this.contact);
|
||||
}
|
||||
} catch (err: any) {
|
||||
// ... error handling
|
||||
}
|
||||
}
|
||||
|
||||
async loadGives(activeDid: string, contact: Contact) {
|
||||
// Uses activeDid parameter
|
||||
// ... implementation
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Required Changes:**
|
||||
|
||||
```vue
|
||||
<script lang="ts">
|
||||
export default class ContactAmountsView extends Vue {
|
||||
activeDid = ""; // Component data still needed
|
||||
|
||||
async created() {
|
||||
try {
|
||||
const contactDid = this.$route.query["contactDid"] as string;
|
||||
const contact = await this.$getContact(contactDid);
|
||||
this.contact = contact;
|
||||
|
||||
// Use the proper API method instead of direct settings access
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
|
||||
if (this.activeDid && this.contact) {
|
||||
this.loadGives(this.activeDid, this.contact);
|
||||
}
|
||||
} catch (err: any) {
|
||||
// ... error handling
|
||||
}
|
||||
}
|
||||
|
||||
// No changes needed - method will work automatically
|
||||
async loadGives(activeDid: string, contact: Contact) {
|
||||
// Uses activeDid parameter
|
||||
// ... implementation
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Key Insight**: This component needs one specific change - replace
|
||||
`$getSettings(MASTER_SETTINGS_KEY)` with `$accountSettings()`. The
|
||||
rest of the component works automatically.
|
||||
|
||||
### **Service Layer Impact**
|
||||
|
||||
1. **`WebPlatformService.ts`**
|
||||
|
||||
Reference in New Issue
Block a user