-
-
Save ShekMak/b7e0dff878104b3cebd69f803d65a5bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Task from "../models/Task"; | |
import { addDocument, getCollectionAt, getCollectionWithLimit, getDocument, updateDocument } from "./firestore"; | |
export const getTasks = async (state: boolean, uidUser: string) => { | |
return await getCollectionWithLimit<Task>('tasks', 'createdAt', state, uidUser); | |
}; | |
export const getMoreTasks = (lastElement: any, state: boolean, uidUser: string) => getCollectionAt<Task>('tasks', 'createdAt', `tasks/${lastElement}`, state, uidUser); | |
export const getTask = (uidTask: string) => getDocument<Task>(`tasks/${uidTask}`); | |
export const addTask = (task: Task) => addDocument('tasks', task); | |
export const UpdateTask = (task: Task) => updateDocument(`tasks/${task.id}`, task); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment