fix: remove vuex leftover from setModuleLoading (#2716)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: #2716 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
0350e37fbb
commit
3aaacf4533
@ -286,7 +286,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
async function verifyEmail(): Promise<boolean> {
|
||||
const emailVerifyToken = localStorage.getItem('emailConfirmToken')
|
||||
if (emailVerifyToken) {
|
||||
const stopLoading = setModuleLoading(this, setIsLoading)
|
||||
const stopLoading = setModuleLoading(setIsLoading)
|
||||
try {
|
||||
await HTTPFactory().post('user/confirm', {token: emailVerifyToken})
|
||||
return true
|
||||
@ -309,7 +309,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}) {
|
||||
const userSettingsService = new UserSettingsService()
|
||||
|
||||
const cancel = setModuleLoading(this, setIsLoadingGeneralSettings)
|
||||
const cancel = setModuleLoading(setIsLoadingGeneralSettings)
|
||||
try {
|
||||
saveLanguage(settings.language)
|
||||
await userSettingsService.update(settings)
|
||||
|
@ -1,23 +1,9 @@
|
||||
export interface LoadingState {
|
||||
isLoading: boolean
|
||||
}
|
||||
|
||||
const LOADING_TIMEOUT = 100
|
||||
|
||||
export const setModuleLoading = <Store extends LoadingState>(store: Store, loadFunc : ((isLoading: boolean) => void) | null = null) => {
|
||||
const timeout = setTimeout(() => {
|
||||
if (loadFunc === null) {
|
||||
store.isLoading = true
|
||||
} else {
|
||||
loadFunc(true)
|
||||
}
|
||||
}, LOADING_TIMEOUT)
|
||||
export function setModuleLoading(loadFunc: (isLoading: boolean) => void) {
|
||||
const timeout = setTimeout(() => loadFunc(true), LOADING_TIMEOUT)
|
||||
return () => {
|
||||
clearTimeout(timeout)
|
||||
if (loadFunc === null) {
|
||||
store.isLoading = false
|
||||
} else {
|
||||
loadFunc(false)
|
||||
}
|
||||
loadFunc(false)
|
||||
}
|
||||
}
|
@ -224,7 +224,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
}
|
||||
|
||||
async function loadBucketsForList({listId, params}: {listId: IList['id'], params}) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
// Clear everything to prevent having old buckets in the list if loading the buckets from this list takes a few moments
|
||||
setBuckets([])
|
||||
@ -259,7 +259,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
setBucketLoading({bucketId: bucketId, loading: true})
|
||||
|
||||
const params = JSON.parse(JSON.stringify(ps))
|
||||
@ -302,7 +302,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
}
|
||||
|
||||
async function createBucket(bucket: IBucket) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
const bucketService = new BucketService()
|
||||
try {
|
||||
@ -315,7 +315,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
}
|
||||
|
||||
async function deleteBucket({bucket, params}: {bucket: IBucket, params}) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
const bucketService = new BucketService()
|
||||
try {
|
||||
@ -330,7 +330,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
}
|
||||
|
||||
async function updateBucket(updatedBucketData: Partial<IBucket>) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
const bucketIndex = findIndexById(buckets.value, updatedBucketData.id)
|
||||
const oldBucket = cloneDeep(buckets.value[bucketIndex])
|
||||
|
@ -81,7 +81,7 @@ export const useLabelStore = defineStore('label', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
try {
|
||||
const newLabels = await getAllLabels()
|
||||
@ -93,7 +93,7 @@ export const useLabelStore = defineStore('label', () => {
|
||||
}
|
||||
|
||||
async function deleteLabel(label: ILabel) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const labelService = new LabelService()
|
||||
|
||||
try {
|
||||
@ -107,7 +107,7 @@ export const useLabelStore = defineStore('label', () => {
|
||||
}
|
||||
|
||||
async function updateLabel(label: ILabel) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const labelService = new LabelService()
|
||||
|
||||
try {
|
||||
@ -121,7 +121,7 @@ export const useLabelStore = defineStore('label', () => {
|
||||
}
|
||||
|
||||
async function createLabel(label: ILabel) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const labelService = new LabelService()
|
||||
|
||||
try {
|
||||
|
@ -95,7 +95,7 @@ export const useListStore = defineStore('list', () => {
|
||||
}
|
||||
|
||||
async function createList(list: IList) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const listService = new ListService()
|
||||
|
||||
try {
|
||||
@ -110,7 +110,7 @@ export const useListStore = defineStore('list', () => {
|
||||
}
|
||||
|
||||
async function updateList(list: IList) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const listService = new ListService()
|
||||
|
||||
try {
|
||||
@ -145,7 +145,7 @@ export const useListStore = defineStore('list', () => {
|
||||
}
|
||||
|
||||
async function deleteList(list: IList) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const listService = new ListService()
|
||||
|
||||
try {
|
||||
|
@ -148,7 +148,7 @@ export const useNamespaceStore = defineStore('namespace', () => {
|
||||
}
|
||||
|
||||
async function loadNamespaces() {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
const namespaceService = new NamespaceService()
|
||||
try {
|
||||
@ -182,7 +182,7 @@ export const useNamespaceStore = defineStore('namespace', () => {
|
||||
}
|
||||
|
||||
async function deleteNamespace(namespace: INamespace) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const namespaceService = new NamespaceService()
|
||||
|
||||
try {
|
||||
@ -195,7 +195,7 @@ export const useNamespaceStore = defineStore('namespace', () => {
|
||||
}
|
||||
|
||||
async function createNamespace(namespace: INamespace) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const namespaceService = new NamespaceService()
|
||||
|
||||
try {
|
||||
|
@ -104,7 +104,7 @@ export const useTaskStore = defineStore('task', () => {
|
||||
async function loadTasks(params) {
|
||||
const taskService = new TaskService()
|
||||
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
try {
|
||||
tasks.value = await taskService.getAll({}, params)
|
||||
baseStore.setHasTasks(tasks.value.length > 0)
|
||||
@ -115,7 +115,7 @@ export const useTaskStore = defineStore('task', () => {
|
||||
}
|
||||
|
||||
async function update(task: ITask) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
const taskService = new TaskService()
|
||||
try {
|
||||
@ -172,7 +172,7 @@ export const useTaskStore = defineStore('task', () => {
|
||||
user: IUser,
|
||||
taskId: ITask['id']
|
||||
}) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
|
||||
try {
|
||||
const taskAssigneeService = new TaskAssigneeService()
|
||||
@ -370,7 +370,7 @@ export const useTaskStore = defineStore('task', () => {
|
||||
} :
|
||||
Partial<ITask>,
|
||||
) {
|
||||
const cancel = setModuleLoading(this, setIsLoading)
|
||||
const cancel = setModuleLoading(setIsLoading)
|
||||
const parsedTask = parseTaskText(title, getQuickAddMagicMode())
|
||||
|
||||
const foundListId = await findListId({
|
||||
|
Reference in New Issue
Block a user