Skip to content

Commit

Permalink
chore: fix deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
TseHang committed Oct 21, 2020
1 parent 8516026 commit 5f08d54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { v4 as uuidv4 } from 'uuid';
import { Note, notes } from './fakeData';

export const handlers = [
graphql.query('GetNotes', (req, res, ctx) => {
graphql.query('GetNotes', (_, res, ctx) => {
return res(ctx.data({ notes }));
}),

Expand Down
8 changes: 3 additions & 5 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import { ThemeProvider } from 'styled-components';

import MockingWorker from '@/components/MockingWorker';
import { isDev } from '@/constants';
import useApollo from '@/hooks/useApollo';
import GlobalStyle from '@/styles/global.ts';
import { theme } from '@/styles/theme';
Expand All @@ -12,16 +11,15 @@ import { ApolloProvider } from '@apollo/client';
export default function App({ Component, pageProps }: AppProps) {
const apolloClient = useApollo(pageProps.initialApolloState);

const Wrapper = isDev ? MockingWorker : React.Fragment;

return (
<Wrapper>
// need to change wrapper when production
<MockingWorker>
<GlobalStyle />
<ApolloProvider client={apolloClient}>
<ThemeProvider theme={theme}>
<Component {...pageProps} />
</ThemeProvider>
</ApolloProvider>
</Wrapper>
</MockingWorker>
);
}
7 changes: 5 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import { GetNote, GetNoteVariables, GetNotes } from '@/typings/gql';
import { useQuery } from '@apollo/client';

const App = () => {
const parsed = queryString.parse(location.search);
const noteId = parsed.noteId as string;
let noteId: string = '';
if (process.browser) {
const parsed = queryString.parse(location.search);
noteId = parsed.noteId as string;
}

const { data: notesData } = useQuery<GetNotes>(GET_NOTES);
const { data: noteData } = useQuery<GetNote, GetNoteVariables>(GET_NOTE, {
Expand Down

1 comment on commit 5f08d54

@vercel
Copy link

@vercel vercel bot commented on 5f08d54 Oct 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.