feat(frontend): ScheduleConfig V2 types, weekday schema, export update
This commit is contained in:
@@ -84,7 +84,7 @@ export function useChannelForm(channel: ChannelResponse | null) {
|
||||
setName(channel.name);
|
||||
setDescription(channel.description ?? "");
|
||||
setTimezone(channel.timezone);
|
||||
setBlocks(channel.schedule_config.blocks);
|
||||
setBlocks(channel.schedule_config.day_blocks['monday'] ?? []);
|
||||
setRecyclePolicy(channel.recycle_policy);
|
||||
setAutoSchedule(channel.auto_schedule);
|
||||
setAccessMode(channel.access_mode ?? "public");
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useState } from "react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { api } from "@/lib/api";
|
||||
import type { ChannelImportData } from "@/app/(main)/dashboard/components/import-channel-dialog";
|
||||
import { WEEKDAYS } from "@/lib/types";
|
||||
import type { Weekday } from "@/lib/types";
|
||||
|
||||
export function useImportChannel(token: string | null) {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -26,7 +28,11 @@ export function useImportChannel(token: string | null) {
|
||||
await api.channels.update(
|
||||
created.id,
|
||||
{
|
||||
schedule_config: { blocks: data.blocks },
|
||||
schedule_config: {
|
||||
day_blocks: Object.fromEntries(
|
||||
WEEKDAYS.map(d => [d, d === 'monday' ? data.blocks : []])
|
||||
) as Record<Weekday, typeof data.blocks>,
|
||||
},
|
||||
recycle_policy: data.recycle_policy,
|
||||
},
|
||||
token,
|
||||
|
||||
Reference in New Issue
Block a user