Skip to content

Commit

Permalink
yolo
Browse files Browse the repository at this point in the history
  • Loading branch information
punnkam committed Feb 18, 2023
1 parent f0f9747 commit c3319ac
Show file tree
Hide file tree
Showing 11 changed files with 304 additions and 105 deletions.
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_CONVEX_URL="https://grandiose-whale-268.convex.cloud"
17 changes: 12 additions & 5 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import 'react-native-get-random-values';
import { useMutation, useQuery } from './convex/_generated/react';
import { ConvexProvider, ConvexReactClient } from 'convex/react';
import Test from './components/Test';


const convex = new ConvexReactClient(CONVEX_URL, {
const convex = new ConvexReactClient("https://frugal-crocodile-166.convex.cloud", {
// We need to disable this to be compatible with React Native
unsavedChangesWarning: false,
});

export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
<ConvexProvider client={convex}>
<View style={styles.container}>
<Test />

<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
</ConvexProvider>
);
}

Expand Down
9 changes: 9 additions & 0 deletions components/Test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { useMutation, useQuery } from '../convex/_generated/react';
import { Text } from 'react-native';

export default function Test() {
const counter = useQuery('makePayment') ?? 0;
console.log(counter);
return <Text>{counter[0].amount}</Text>;
}
5 changes: 4 additions & 1 deletion convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import type { ApiFromModules } from "convex/api";
import type * as makePayment from "../makePayment";

/**
* A type describing your app's public Convex API.
Expand All @@ -20,4 +21,6 @@ import type { ApiFromModules } from "convex/api";
* This type should be used with type-parameterized classes like
* `ConvexReactClient` to create app-specific types.
*/
export type API = ApiFromModules<{}>;
export type API = ApiFromModules<{
makePayment: typeof makePayment;
}>;
Empty file added convex/addProperty.ts
Empty file.
Binary file removed convex/lease.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions convex/makePayment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { mutation } from './_generated/server';

interface Payment {
amount: number;
}

export default mutation(async ({ db }, body, author) => {
const message = { body, author };
await db.insert('messages', message);
});
41 changes: 0 additions & 41 deletions convex/parseLease.ts

This file was deleted.

Loading

0 comments on commit c3319ac

Please sign in to comment.