Skip to content

Commit

Permalink
Merge pull request #79 from jludwig/add-sync-tasks-button
Browse files Browse the repository at this point in the history
Add Manual "Sync" Button for Immediate Task Synchronization
  • Loading branch information
DCsunset authored Oct 12, 2023
2 parents 4ae74aa + cf29f89 commit 6566cbe
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions frontend/components/TaskList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@
>
<v-icon>mdi-refresh</v-icon>
</v-btn>

<v-btn
v-if="showSyncBtn"
class="green ml-1"
fab
dark
title="Sync Tasks"
@click="syncTasks"
>
<v-icon>mdi-sync</v-icon>
</v-btn>

<v-btn
class="primary ml-1"
fab
Expand Down Expand Up @@ -341,6 +353,26 @@ export default defineComponent({
const showTaskDialog = ref(false);
const currentTask: Ref<Task | null> = ref(null);
const showSyncBtn = computed(() => {
return store.state.settings.autoSync !== '0';
});
const syncTasks = async () => {
try {
await store.dispatch('syncTasks');
store.commit('setNotification', {
color: 'success',
text: 'Successfully synced tasks.'
});
} catch (error) {
store.commit('setNotification', {
color: 'error',
text: 'Failed to sync tasks.'
});
}
};
const newTask = () => {
showTaskDialog.value = true;
currentTask.value = null;
Expand Down Expand Up @@ -416,6 +448,8 @@ export default defineComponent({
allStatus,
statusIcons,
selected,
showSyncBtn,
syncTasks,
newTask,
currentTask,
editTask,
Expand Down

0 comments on commit 6566cbe

Please sign in to comment.