This file contains hidden or 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
export default function Home() { | |
const { loading, data } = useQuery(CURRENT_USER, { | |
variables: {} | |
}) | |
if (!data) { | |
// redirect to a hosted auth0 login page | |
return <Redirect to="/api/login" /> | |
} |
This file contains hidden or 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 {ApolloLink, Observable, gql} from '@apollo/client'; | |
import jwtDecode from 'jwt-decode'; | |
import constants from 'lib/constants'; | |
import client from '../index'; | |
const isTokenExpired = (token) => { | |
const currentTime = Date.now() / 1000; | |
const decodedToken = jwtDecode(token); | |
return decodedToken.exp < currentTime; | |
}; |
This file contains hidden or 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
const File = () => { | |
return ( | |
<FormItem label="Year Built" error={this.state.yearError}> | |
<NumberInput | |
min={0} | |
onChange={(yearBuilt) => { | |
// *********** clear your error message here | |
this.setState({ yearError: null }) | |
This file contains hidden or 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 React, { useState } from 'react' | |
const FilesArea = ({ defaultFiles }) => { | |
const [localFiles, setLocalFiles] = useState([]); | |
const onUpload = (e) => { | |
let file = e.target.files[0]; | |
let uploadedFilesLength = defaultFiles.length + localFiles.length; // figure out how many files the've uploaded thus far |
This file contains hidden or 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
// TOP LEVEL IMPORTS | |
import React from 'react'; | |
import styled, {keyframes} from 'styled-components'; | |
const pulse = keyframes` | |
0% { | |
transform: scale(0.9); | |
box-shadow: 0 0 0 0 rgba(124, 196, 250, .7) | |
} | |
70% { |
This file contains hidden or 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 React from 'react'; | |
import MY_MUTATION from 'ApolloClient/Mutations/myMutation.js' | |
import { graphql } from 'react-apollo' | |
class MyFunctionComponent extends React.PureComponent { | |
handleOnClick = async () => { | |
await this.props.myMutation({}) | |
} |
This file contains hidden or 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 React from 'react'; | |
import MY_MUTATION from 'ApolloClient/Mutations/myMutation.js' | |
import { useMutation } from 'react-apollo' | |
const MyFunctionComponent = () => { | |
const [myMutation] = useMutation(MY_MUTATION); | |
const handleOnClick = async () => { | |
await myMutation({}) |
This file contains hidden or 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
// ******************************************************** | |
// Mutations/resolvers/createTask.js | |
import Users from 'collections/Users/model'; | |
import Tasks from 'collections/Tasks/model'; | |
const createTask = async (root, args, context) => { | |
let user = await Users.findOne({ | |
_id: args.params.userId, | |
}); |
This file contains hidden or 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
#fasklfjaslfas |
This file contains hidden or 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
const schema = new Mongo.Schema({ | |
...baseFields, // baseFields includes createdAt, createdBy, updatedAt, updatedBy | |
id: String, | |
title: String, // "Task Created" | |
description: String, // "Anthony created a task for Jessica" | |
activityType: { | |
// list of all possible types | |
type: String, | |
enum: [ | |
'noteAdded', // when somebody adds a note |
NewerOlder