-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fe): add apollo vscode ext settings (#1379)
* feat(fe): add apollo vscode ext settings * feat(fe): add apollo codegen * fix: ignore generated files for apollo extension * feat: use useClient hook * chore: only ban importing gql from apollo/client * chore: remove unused dockerfile * chore: upgrade pnpm action
- Loading branch information
1 parent
63ec4f5
commit 4cc9880
Showing
24 changed files
with
2,364 additions
and
787 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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ node_modules/ | |
pnpm-lock.yaml | ||
.pnpm-store/ | ||
@generated/ | ||
__generated__/ | ||
schema.gql | ||
collection/ | ||
.next/ | ||
|
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,3 +1,11 @@ | ||
{ | ||
"recommendations": ["ms-vscode-remote.remote-containers"] | ||
// Recommendations for Frontend team, developing without devcontainer | ||
"recommendations": [ | ||
"apollographql.vscode-apollo", | ||
"dbaeumer.vscode-eslint", | ||
"donjayamanne.githistory", | ||
"eamodio.gitlens", | ||
"EditorConfig.EditorConfig", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
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,10 @@ | ||
module.exports = { | ||
client: { | ||
includes: ['./frontend-client/**/*.ts', './frontend-client/**/*.tsx'], | ||
excludes: ['**/__generated__/**'], | ||
service: { | ||
name: 'codedang-graphql-app', | ||
url: 'https://dev.codedang.com/graphql' | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -34,3 +34,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# GraphQL Codegen | ||
__generated__/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
'use client' | ||
|
||
import { auth } from '@/lib/auth' | ||
import { adminBaseUrl } from '@/lib/vars' | ||
import { | ||
ApolloClient, | ||
ApolloLink, | ||
ApolloProvider, | ||
InMemoryCache, | ||
createHttpLink | ||
} from '@apollo/client' | ||
import { setContext } from '@apollo/client/link/context' | ||
|
||
interface Props { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function ClientApolloProvider({ children }: Props) { | ||
const httpLink = createHttpLink({ | ||
uri: adminBaseUrl | ||
}) | ||
const authLink = setContext(async (_, { headers }) => { | ||
const session = await auth() | ||
return { | ||
headers: { | ||
...headers, | ||
authorization: session?.token.accessToken | ||
} | ||
} | ||
}) | ||
const link = ApolloLink.from([authLink.concat(httpLink)]) | ||
|
||
const client = new ApolloClient({ | ||
cache: new InMemoryCache(), | ||
link, | ||
defaultContext: { | ||
fetchOptions: { | ||
next: { revalidate: 0 } | ||
} | ||
} | ||
}) | ||
|
||
return <ApolloProvider client={client}>{children}</ApolloProvider> | ||
} |
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
Oops, something went wrong.