Skip to content

Commit

Permalink
Eslint problem fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarcnicasource committed Jun 9, 2023
1 parent 4d4a3e8 commit b357348
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/useForm.tsx
Expand Up @@ -9,7 +9,7 @@ export default function useForm<T>(initial:T) {
useEffect(() => {
// This function runs when the things we are watching change
setInputs(initial);
}, [initialValues]);
}, [initialValues, initial]);

// {
// name: 'wes',
Expand Down
50 changes: 26 additions & 24 deletions lib/withData.tsx
@@ -1,7 +1,7 @@
import { ApolloClient, ApolloLink, InMemoryCache, NormalizedCacheObject, createHttpLink, makeVar } from '@apollo/client';
import { ApolloClient, ApolloLink, InMemoryCache, createHttpLink, makeVar } from '@apollo/client';
import { onError } from '@apollo/link-error';
import { getDataFromTree } from '@apollo/client/react/ssr';
import { createUploadLink } from 'apollo-upload-client';
// import { createUploadLink } from 'apollo-upload-client';
import withApollo from 'next-with-apollo';
import { setContext } from '@apollo/client/link/context';
import { endpoint, prodEndpoint } from '../config';
Expand All @@ -17,25 +17,27 @@ export const isLoggedInVar = makeVar(Boolean(token));
export const authTokenVar = makeVar(token);


interface IProps{
// headers: Record<string, string> | undefined
headers: Record<string, string>
initialState: NormalizedCacheObject
}
// interface IProps{
// // headers: Record<string, string> | undefined
// headers: Record<string, string>
// initialState: NormalizedCacheObject
// }

interface IPoliceAllProducts{
args:{
skip: number
first: number
},
cache: InMemoryCache
}
// interface IPoliceAllProducts{
// args:{
// skip: number
// first: number
// },
// cache: InMemoryCache
// }

type IHeader = Record<string, string>
// type IHeader = Record<string, string>

export default withApollo(({ ctx, headers, initialState }) => {
// this uses apollo-link-http under the hood, so all the options here come from that package
const headers2 = { ...headers} as IHeader;
console.log(ctx);
console.log(headers);
// const headers2 = { ...headers} as IHeader;

const httpLink = createHttpLink({
uri:
Expand All @@ -54,14 +56,14 @@ export default withApollo(({ ctx, headers, initialState }) => {
});

// headers = headers as undefined
const uploadLink = (createUploadLink({
uri: `${process.env.NODE_ENV}` === 'development' ? endpoint : prodEndpoint,
// fetchOptions: {
// credentials: 'include',
// },
// pass the headers along from this request. This enables SSR with logged in state
headers: headers2,
}) as unknown) as ApolloLink;
// const uploadLink = (createUploadLink({
// uri: `${process.env.NODE_ENV}` === 'development' ? endpoint : prodEndpoint,
// // fetchOptions: {
// // credentials: 'include',
// // },
// // pass the headers along from this request. This enables SSR with logged in state
// headers: headers2,
// }) as unknown) as ApolloLink;

return new ApolloClient({
link: ApolloLink.from([
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"lint": "next lint",
"start": "next start -p ${PORT:=3000}",
"test": "NODE_ENV=test jest --watchAll --verbose",
"build:css": "postcss assets/main.css -o assets/main_browser.css",
Expand Down

0 comments on commit b357348

Please sign in to comment.