-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
user-friendly home and database connection demo
- Loading branch information
1 parent
9196482
commit 677847f
Showing
11 changed files
with
111 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
NEXT_PUBLIC_GRAPHQL_URI="http://localhost:3001/graphql" | ||
MONGO_URI="mongodb+srv://johnDoe:[email protected]/sample_restaurants?retryWrites=true&w=majority" | ||
APOLLO_SERVER_CORS_WHITELIST="http://localhost:3000" | ||
ADMIN_EMAIL="[email protected]" | ||
ADMIN_INITIAL_PASSWORD="vulcan_is_cool" | ||
ADMIN_INITIAL_PASSWORD="vulcan_is_cool" | ||
MONGO_URI="mongodb+srv://johnDoe:[email protected]/sample_restaurants?retryWrites=true&w=majority" | ||
# MONGO_URI="mongodb://localhost:27017/vulcan-next-app" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
20 changes: 17 additions & 3 deletions
20
src/components/user/layout.js → src/components/user/layout.tsx
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Demo queries to a legacy Vulcan Meteor backend | ||
*/ | ||
import { useQuery /*, useMutation*/ } from "@apollo/client"; | ||
import gql from "graphql-tag"; | ||
|
||
const VulcanMeteorDemo = () => { | ||
const vulcanSiteDataQuery = gql` | ||
query getSiteData { | ||
siteData { | ||
url | ||
title | ||
sourceVersion | ||
logoUrl | ||
} | ||
} | ||
`; | ||
|
||
const { data, loading, error } = useQuery(vulcanSiteDataQuery); | ||
|
||
let content; | ||
if (loading) { | ||
content = `Connecting to your graphQL backend...`; // on ${client.name}` | ||
} else if (error) { | ||
if (error.networkError?.message === "Failed to fetch") { | ||
content = `No graphQL backend is running.`; | ||
} else { | ||
content = `Couldn't connect to your graphQL backend (${error}).`; | ||
} | ||
} else if (data) { | ||
content = `Successfully connected to your graphQL backend.\n Data: ${JSON.stringify( | ||
data, | ||
null, | ||
4 | ||
)}`; | ||
} | ||
return content; | ||
}; | ||
|
||
export default VulcanMeteorDemo; |