diff --git a/src/services/tasks/index.ts b/src/services/tasks/index.ts index 817e4f9..ec09e74 100644 --- a/src/services/tasks/index.ts +++ b/src/services/tasks/index.ts @@ -1,27 +1,11 @@ import { Task } from '@/types'; -import { addDoc, collection, CollectionReference, deleteDoc, doc, getDoc, updateDoc } from 'firebase/firestore'; +import { addDoc, collection, CollectionReference, deleteDoc, doc, updateDoc } from 'firebase/firestore'; import { db } from '../db'; export const getTasksCollection = (): CollectionReference => { return collection(db, 'tasks'); }; -export const getTask = async (taskId: Task['id']): Promise => { - const docRef = doc(db, 'tasks', taskId); - const docSnap = await getDoc(docRef); - - if (!docSnap.exists()) { - throw Error(); - } - - const data = { - ...docSnap.data(), - id: taskId, - }; - - return data as Task; -}; - export const createTask = async (task: Omit) => { const tasksCol = getTasksCollection(); await addDoc(tasksCol, task);