UNLV-CS472-672 / 2024-S-GROUP5-Munch

The Munch app is a social platform where users create profiles by selecting preferred foods.
1 stars 11 forks source link

React Query Set Up #47

Closed StacL closed 5 months ago

StacL commented 5 months ago

This closes #46

Description / Changes Made

How to Test

  1. Start backend on local
  2. Add EXPO_PUBLIC_IP_ADDR=<your ip addy> to your frontend .env
  3. Add the SampleMutationRequest or SampleQueryRequest to a page and click the button to send a request

For example, since the friends page is unused currently, I added

import React from 'react';
import { SafeAreaView } from 'react-native';
import { Text, View } from 'tamagui';
import SampleQueryRequest from '../../components/SampleQueryRequest'
import SampleMutationRequest from '../../components/SampleMutationRequest'

const Friends = () => {
  return (
    <SafeAreaView>
      <View>
        <Text>Friends/search page</Text>
        <SampleQueryRequest/>
        <SampleMutationRequest/>
      </View>
    </SafeAreaView>
  );
  1. NOTE: the results are cached by react-query. If you are testing on android emulator, wipe your data if needed or you can invalidate the cache. If working on browser, open developer tools/inspect and right-click refresh button at top left, then click empty cache and hard reload
  2. may also need to specify port number to ensure front and backend ports are the same

Portions of this code that utilized AI generation

Sample Pages

Mutation Example image

Query Example image

Checklist