-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
5,891 additions
and
5,785 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn prettier:check && yarn lint && yarn test | ||
yarn check |
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,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint && yarn build | ||
yarn check && yarn build |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
nodeLinker: node-modules | ||
compressionLevel: mixed | ||
|
||
enableGlobalCache: false | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||
spec: "@yarnpkg/plugin-interactive-tools" | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.4.cjs | ||
yarnPath: .yarn/releases/yarn-4.0.1.cjs |
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 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,61 @@ | ||
import { toast } from 'react-toastify'; | ||
|
||
import { Notifier, configureQueryClient } from '@graasp/apps-query-client'; | ||
|
||
import type { AxiosError } from 'axios'; | ||
|
||
import { InfoToast, NetworkErrorToast } from '@/modules/common/CustomToasts'; | ||
|
||
import { API_HOST, GRAASP_APP_KEY, MOCK_API } from './env'; | ||
|
||
const notifier: Notifier = (data) => { | ||
const { payload } = data; | ||
if (payload) { | ||
// eslint-disable-next-line no-console | ||
console.log(data.payload); | ||
// axios error | ||
if ( | ||
payload.error && | ||
payload.error.name === 'AxiosError' && | ||
(payload.error as AxiosError).response | ||
) { | ||
const { message } = (payload.error as AxiosError).response?.data as { | ||
message: string; | ||
}; | ||
toast.error( | ||
<NetworkErrorToast | ||
title={payload.error.message} | ||
description={message} | ||
/>, | ||
); | ||
} | ||
toast.success(<InfoToast type={data.type} payload={payload} />); | ||
} | ||
}; | ||
|
||
const { | ||
queryClient, | ||
QueryClientProvider, | ||
hooks, | ||
API_ROUTES, | ||
mutations, | ||
ReactQueryDevtools, | ||
} = configureQueryClient({ | ||
API_HOST, | ||
notifier, | ||
refetchOnWindowFocus: !import.meta.env.DEV, | ||
keepPreviousData: true, | ||
// avoid refetching when same data are closely fetched | ||
staleTime: 1000, // ms | ||
GRAASP_APP_KEY, | ||
isStandalone: MOCK_API, | ||
}); | ||
|
||
export { | ||
ReactQueryDevtools, | ||
queryClient, | ||
QueryClientProvider, | ||
hooks, | ||
mutations, | ||
API_ROUTES, | ||
}; |
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,29 @@ | ||
import { Stack, Typography } from '@mui/material'; | ||
|
||
export const NetworkErrorToast = ({ | ||
title, | ||
description, | ||
}: { | ||
title: string; | ||
description?: string; | ||
}): JSX.Element => ( | ||
<Stack> | ||
<Typography fontWeight="bold">{title}</Typography> | ||
<Typography>{description}</Typography> | ||
</Stack> | ||
); | ||
|
||
export const InfoToast = ({ | ||
type, | ||
payload, | ||
}: { | ||
type: string; | ||
payload: unknown; | ||
}): JSX.Element => ( | ||
<Stack> | ||
<Typography fontWeight="bold">{type}</Typography> | ||
<Typography variant="caption"> | ||
{JSON.stringify(payload, null, 2)} | ||
</Typography> | ||
</Stack> | ||
); |
Oops, something went wrong.