import { IFile , IFilePathItem } from './types' ; import { ExtractActionTypes , ExtractActions } from '../common/actions' ; export const FileActions = { createFile : ( id , file ) => ( { type : 'file.create' as const , id , file } ) , deleteFile : ( id ) => ( { type : 'file.delete' as const , id } ) , moveFile : ( id , newPath ) => ( { type : 'file.update.path' as const , id , path : newPath } ) , updateName : ( id , name ) => ( { type : 'file.update.name' as const , id , name } ) , toggleIsLiked : ( id , isLiked ) => ( { type : 'file.update.isLiked' as const , id , isLiked } ) , } ; export type FileActions = ExtractActions < typeof FileActions > ; export type FileActionTypes = ExtractActionTypes < typeof FileActions > ; export const FileActionTypes = ExtractActionTypes ( FileActions ) ;