updates
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
|
||||
<div v-else>
|
||||
|
||||
<!-- Compose New Email -->
|
||||
<div class="mb-4 d-flex align-center gap-2">
|
||||
<!-- Email Controls -->
|
||||
<div class="mb-4 d-flex align-center gap-2 flex-wrap">
|
||||
<v-btn
|
||||
@click="showComposer = true"
|
||||
color="primary"
|
||||
@@ -33,6 +33,24 @@
|
||||
>
|
||||
<v-tooltip activator="parent">Refresh Emails</v-tooltip>
|
||||
</v-btn>
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
@click="reconnectEmail"
|
||||
variant="text"
|
||||
size="small"
|
||||
prepend-icon="mdi-connection"
|
||||
>
|
||||
Reconnect
|
||||
</v-btn>
|
||||
<v-btn
|
||||
@click="disconnectEmail"
|
||||
variant="text"
|
||||
size="small"
|
||||
color="error"
|
||||
prepend-icon="mdi-logout"
|
||||
>
|
||||
Disconnect
|
||||
</v-btn>
|
||||
</div>
|
||||
|
||||
<!-- Email Thread List -->
|
||||
@@ -415,8 +433,14 @@ watch(() => props.interest.Id, () => {
|
||||
});
|
||||
|
||||
const loadEmailThread = async () => {
|
||||
if (!sessionId.value) {
|
||||
console.log('[ClientEmailSection] No sessionId available, skipping email thread load');
|
||||
return;
|
||||
}
|
||||
|
||||
isRefreshing.value = true;
|
||||
try {
|
||||
console.log('[ClientEmailSection] Loading email thread for:', props.interest['Email Address']);
|
||||
const response = await $fetch<{
|
||||
success: boolean;
|
||||
emails: any[];
|
||||
@@ -426,15 +450,18 @@ const loadEmailThread = async () => {
|
||||
'x-tag': '094ut234'
|
||||
},
|
||||
body: {
|
||||
email: props.interest['Email Address']
|
||||
clientEmail: props.interest['Email Address'],
|
||||
interestId: props.interest.Id.toString(),
|
||||
sessionId: sessionId.value
|
||||
}
|
||||
});
|
||||
|
||||
if (response.success) {
|
||||
console.log('[ClientEmailSection] Successfully loaded', response.emails?.length || 0, 'emails');
|
||||
emailThreads.value = response.emails || [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load email thread:', error);
|
||||
console.error('[ClientEmailSection] Failed to load email thread:', error);
|
||||
} finally {
|
||||
isRefreshing.value = false;
|
||||
}
|
||||
@@ -641,6 +668,24 @@ const onCredentialsSaved = (data: { sessionId: string }) => {
|
||||
toast.success('Email credentials saved successfully');
|
||||
};
|
||||
|
||||
const disconnectEmail = () => {
|
||||
// Clear stored credentials
|
||||
localStorage.removeItem('emailSessionId');
|
||||
localStorage.removeItem('emailSignature');
|
||||
sessionId.value = '';
|
||||
hasEmailCredentials.value = false;
|
||||
emailThreads.value = [];
|
||||
toast.success('Email disconnected');
|
||||
};
|
||||
|
||||
const reconnectEmail = () => {
|
||||
// Clear current session to force re-authentication
|
||||
localStorage.removeItem('emailSessionId');
|
||||
sessionId.value = '';
|
||||
hasEmailCredentials.value = false;
|
||||
toast.info('Please enter your email credentials');
|
||||
};
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
if (!dateString) return '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user