mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
9 lines
356 B
TypeScript
9 lines
356 B
TypeScript
import { offlineDb } from './offlineDb'
|
|
import type { Assignment } from '../types'
|
|
|
|
export async function cacheAssignment(assignment: Assignment): Promise<void> {
|
|
await offlineDb.days.where('id').equals(assignment.day_id).modify(day => {
|
|
day.assignments = (day.assignments ?? []).map(a => a.id === assignment.id ? { ...a, ...assignment } : a)
|
|
})
|
|
}
|