123
This commit is contained in:
parent
c16561cfd1
commit
0ea3ed69d1
2
package-lock.json
generated
2
package-lock.json
generated
@ -2062,7 +2062,7 @@
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
|
||||
"resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz",
|
||||
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
|
||||
"dev": true
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
const [basket, setBasket] = useState<Array<Basket>>([]);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const { closeSnackbar } = useSnackbar();
|
||||
|
||||
const CAS = useContext(CASContext)!;
|
||||
const token = CAS?.user?.token;
|
||||
@ -60,14 +61,28 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
data: JSON.stringify(basketIds),
|
||||
};
|
||||
|
||||
const action = (key: any) => (
|
||||
<>
|
||||
<button
|
||||
onClick={() => {
|
||||
closeSnackbar(key);
|
||||
}}
|
||||
>
|
||||
X
|
||||
</button>
|
||||
</>
|
||||
);
|
||||
|
||||
try {
|
||||
await axios.request(config);
|
||||
enqueueSnackbar('Plan został zapisany', {
|
||||
variant: 'success',
|
||||
action,
|
||||
});
|
||||
} catch (e) {
|
||||
enqueueSnackbar('Zapisywanie planu nie powiodło się', {
|
||||
variant: 'error',
|
||||
action,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user