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
| # Endpoint for associating sucessfully created Stripe subscription | |
| # with the Adult document. Needs body with paymentMethodId (from | |
| # Stripe in frontend), priceId (from frontend, matches the priceId | |
| # for selected option in Stripe), and childId (probably will be changed | |
| # to create child here?) | |
| @stripe_blueprint.route('/create_subscription', methods=['POST']) | |
| def createSubscription(): | |
| body = request.get_json() | |
| email = body["email"] | |
| receives_emails = body["receivesEmails"] |
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 fetchBackExercises = async () => { | |
| const data = await axios.get('/exercises', {params: {muscleGroup: 'back'}}); | |
| return data; | |
| } | |
| const onError = (error) => { | |
| console.error(error); | |
| } | |
| const { data, isLoading } = useQuery( |
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 ExerciseList = () => { | |
| const fetchBackExercises = async () => { | |
| const data = await axios.get('/exercises', {params: {muscleGroup: 'back'}}); | |
| return data; | |
| } | |
| const onError = (error) => { | |
| console.error(error); | |
| } | |
| const { data = [], isLoading } = useQuery( | |
| ['exercises', 'back'], |
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 useExercises = (muscleGroup) => { | |
| const fetchExercises = async () => { | |
| const data = await axios.get('/exercises', {params: {muscleGroup}}); | |
| return data; | |
| } | |
| const onError = (error) => { | |
| console.error(error); | |
| } | |
| const { data, isLoading } = useQuery( | |
| ['exercises', muscleGroup], |
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 axios from 'axios'; | |
| import { useQuery } from 'react-query'; | |
| const query = async ({queryKey}) => { | |
| const [_, id] = queryKey; | |
| const data = await axios.get(`/teams/${id}`); | |
| return data; | |
| } | |
| const useTeam = (id) => { |
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 axios from 'axios'; | |
| import { useQuery } from 'react-query'; | |
| const useTeam = (id) => { | |
| const query = async () => { | |
| const data = await axios.get(`/teams/${id}`); | |
| return data; | |
| } | |
| const { data, isLoading } = useQuery(['team', id], query); |
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 axios from 'axios'; | |
| import { useQuery } from 'react-query'; | |
| const useTeam = (id) => { | |
| const getTeam = async () => { | |
| const data = await axios.get(`/teams/${id}`); | |
| return data; | |
| } | |
| const { data, isLoading } = useQuery(['team', id], getTeam); |
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 sumOfTwoNumbers = (arr, target) => { | |
| // sort the array in asc order so we can use a sliding window technique to find sum | |
| arr.sort((a, b) => a - b) | |
| // use two pointers to implement a sliding window technique on sorted array | |
| // if we never equal the target sum and the pointer cross, there is no suitable pair | |
| let leftPointer = 0; | |
| let rightPointer = arr.length - 1; | |
| const sumLessThanTarget = () => arr[leftPointer] + arr[rightPointer] < target |
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 { useMutation, useQuery } from 'react-query'; | |
| import React from 'react'; | |
| import axios from 'axios'; | |
| const NotificationsDrawer = () => { | |
| const {notifications, markAsRead } = useNotifications() | |
| return ( | |
| <Drawer> | |
| {notifications.map(notifcation => ( | |
| <NotificationCard notification={notification} markAsRead={markAsRead} /> |
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, { createContext, useContext, useEffect, useState } from 'react'; | |
| import { useQuery } from 'react-query'; | |
| const TeamContext = createContext({ | |
| isLoading: false, | |
| team: undefined, | |
| setTeam: undefined, | |
| allTeams: [], | |
| }); |
OlderNewer