feat: complete hosted mod sync and launcher interface updates
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Add pack sync markers, tagged mod updates, parallel progress, JWT downloads and retry recovery. Include pending onboarding, about scene, compatibility data pack and download fixes.
This commit is contained in:
37
apps/app-frontend/src/composables/useHostedSync.ts
Normal file
37
apps/app-frontend/src/composables/useHostedSync.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { computed, reactive } from 'vue'
|
||||
import { hostedSync, type HostedSyncResult } from '../helpers/hosted-packs.ts'
|
||||
|
||||
const tasks = reactive(
|
||||
new Map<string, { busy: boolean; result: HostedSyncResult | null; error: string }>(),
|
||||
)
|
||||
|
||||
export function useHostedSync(instanceId: () => string) {
|
||||
const task = computed(() => {
|
||||
const id = instanceId()
|
||||
if (!tasks.has(id)) tasks.set(id, { busy: false, result: null, error: '' })
|
||||
return tasks.get(id)!
|
||||
})
|
||||
|
||||
async function sync() {
|
||||
const id = instanceId()
|
||||
const current = task.value
|
||||
if (current.busy) return
|
||||
current.busy = true
|
||||
current.error = ''
|
||||
current.result = null
|
||||
try {
|
||||
current.result = await hostedSync(id)
|
||||
} catch (error) {
|
||||
current.error = String(error)
|
||||
} finally {
|
||||
current.busy = false
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
busy: computed(() => task.value.busy),
|
||||
result: computed(() => task.value.result),
|
||||
error: computed(() => task.value.error),
|
||||
sync,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user