refactor: Replace Webpack with Vite (#53)
This commit is contained in:
12
src/pages/background/lib/switchSchedule.ts
Normal file
12
src/pages/background/lib/switchSchedule.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
export default async function switchSchedule(scheduleName: string): Promise<void> {
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
|
||||
const scheduleIndex = schedules.findIndex(schedule => schedule.name === scheduleName);
|
||||
if (scheduleIndex === -1) {
|
||||
throw new Error(`Schedule ${scheduleName} does not exist`);
|
||||
}
|
||||
|
||||
await UserScheduleStore.set('activeIndex', scheduleIndex);
|
||||
}
|
||||
Reference in New Issue
Block a user