Skip to content

Instantly share code, notes, and snippets.

View indreklasn's full-sized avatar
👋

Trevor I. Lasn indreklasn

👋
View GitHub Profile
import { client, q } from '../config/db'
const deleteNote = noteRef => client.query(
q.Delete(q.Ref(q.Collection('notes'), noteRef))
)
.then(res => res)
.catch(err => console.warn(err.message))
export default deleteNote
import { client, q } from '../config/db'
const editNote = (noteId, newText) => client.query(
q.Update(
q.Ref(q.Collection('notes'), noteId),
{ data: { text: newText } },
)
)
.then((ret) => console.log(ret))
.catch(err => console.warn(err))
import { client, q } from '../config/db'
const getAllNotes = client.query(
q.Paginate(
q.Match(
q.Ref('indexes/all_notes')))
)
.then(response => {
const notesRefs = response.data
// create new query out of notes refs.
import faunadb from 'faunadb'
const client = new faunadb.Client({ secret: process.env.REACT_APP_FAUNADB_KEY })
const q = faunadb.query
export { client , q }
import React, { useEffect, useState } from 'react';
import getAllProducts from './fauna/get-all-products.js'
function App() {
const [data, setData] = useState('')
useEffect(() => {
getAllProducts.then(data => setData(data))
}, [])
import { client, q } from './db'
const getAllProducts = client.query(
q.Paginate(
q.Match(
q.Ref('indexes/all_products')))
)
.then((response) => {
const productRefs = response.data
// create new query out of todo refs.
import { client, q } from './db'
const getAllProducts = client.query(
q.Paginate(
q.Match(
q.Ref('indexes/all_products')))
)
.then((response) => {
const productRefs = response.data
// create new query out of todo refs.
import { client, q } from './db'
const getAllProducts = client.query(
q.Paginate(
q.Match(
q.Ref('indexes/all_products')))
)
.then((response) => {
const productRefs = response.data
// create new query out of todo refs.
import React, { useEffect, useState } from 'react';
function App() {
const [data, setData] = useState('')
useEffect(() => {
fetch('/.netlify/functions/hello-world')
.then((response) => response.json())
.then(data => setData(data))
import React, { useEffect, useState } from 'react';
function App() {
const [data, setData] = useState('')
useEffect(() => {
fetch('/.netlify/functions/hello-world')
.then((response) => response.json())
.then(data => setData(data))