feat: refine content calendar experience
This commit is contained in:
@@ -128,6 +128,29 @@ export const useCalendarIntegrationsStore = defineStore('calendar-integrations',
|
||||
}
|
||||
}
|
||||
|
||||
async function updateSource(sourceId, payload) {
|
||||
if (!sourceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
error.value = null;
|
||||
|
||||
try {
|
||||
const response = await client.put(`/api/calendar-integrations/sources/${sourceId}`, payload);
|
||||
const updatedSource = response.data;
|
||||
if (updatedSource) {
|
||||
sources.value = sources.value.map(source =>
|
||||
source.id === updatedSource.id ? updatedSource : source
|
||||
);
|
||||
}
|
||||
return updatedSource;
|
||||
} catch (updateError) {
|
||||
console.error('Failed to update calendar source:', updateError);
|
||||
error.value = 'Failed to update calendar source.';
|
||||
throw updateError;
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshSource(sourceId) {
|
||||
if (!sourceId) {
|
||||
return null;
|
||||
@@ -176,6 +199,7 @@ export const useCalendarIntegrationsStore = defineStore('calendar-integrations',
|
||||
fetchEvents,
|
||||
searchCatalog,
|
||||
createSource,
|
||||
updateSource,
|
||||
refreshSource,
|
||||
toggleSourceVisibility,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user