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": {
|
"dependencies": {
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "7.3.2",
|
"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==",
|
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
const [basket, setBasket] = useState<Array<Basket>>([]);
|
const [basket, setBasket] = useState<Array<Basket>>([]);
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
const { closeSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const CAS = useContext(CASContext)!;
|
const CAS = useContext(CASContext)!;
|
||||||
const token = CAS?.user?.token;
|
const token = CAS?.user?.token;
|
||||||
@ -60,14 +61,28 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
data: JSON.stringify(basketIds),
|
data: JSON.stringify(basketIds),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const action = (key: any) => (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
closeSnackbar(key);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
X
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.request(config);
|
await axios.request(config);
|
||||||
enqueueSnackbar('Plan został zapisany', {
|
enqueueSnackbar('Plan został zapisany', {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
|
action,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
enqueueSnackbar('Zapisywanie planu nie powiodło się', {
|
enqueueSnackbar('Zapisywanie planu nie powiodło się', {
|
||||||
variant: 'error',
|
variant: 'error',
|
||||||
|
action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user