Skip to content

Instantly share code, notes, and snippets.

@ShekMak
Created February 20, 2022 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShekMak/b7e0dff878104b3cebd69f803d65a5bf to your computer and use it in GitHub Desktop.
Save ShekMak/b7e0dff878104b3cebd69f803d65a5bf to your computer and use it in GitHub Desktop.
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