we store user token in session storage now
This commit is contained in:
parent
99d878762e
commit
a4ff47bdb5
24
build/asset-manifest.json
Normal file
24
build/asset-manifest.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.993a2e72.chunk.js",
|
||||
"main.js.map": "/static/js/main.993a2e72.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.38573804.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.38573804.js.map",
|
||||
"static/js/2.f941ed96.chunk.js": "/static/js/2.f941ed96.chunk.js",
|
||||
"static/js/2.f941ed96.chunk.js.map": "/static/js/2.f941ed96.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"precache-manifest.36f396009b702c50e7d07732240c69e5.js": "/precache-manifest.36f396009b702c50e7d07732240c69e5.js",
|
||||
"service-worker.js": "/service-worker.js",
|
||||
"static/js/2.f941ed96.chunk.js.LICENSE.txt": "/static/js/2.f941ed96.chunk.js.LICENSE.txt",
|
||||
"static/media/PL.png": "/static/media/PL.6e9ee893.png",
|
||||
"static/media/UK.png": "/static/media/UK.b4dad475.png",
|
||||
"static/media/close.svg": "/static/media/close.464128e7.svg",
|
||||
"static/media/search.svg": "/static/media/search.fa0d12ae.svg",
|
||||
"static/media/user.png": "/static/media/user.4ba6e2a4.png"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.38573804.js",
|
||||
"static/js/2.f941ed96.chunk.js",
|
||||
"static/js/main.993a2e72.chunk.js"
|
||||
]
|
||||
}
|
1
build/index.html
Normal file
1
build/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="pl"><head><meta charset="utf-8"/><link rel="icon" href="/logo.svg"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo.svg"/><link rel="manifest" href="/manifest.json"/><title>PlanNaPlan</title></head><body><noscript>Potrzebujesz włączyć JavaScript, żeby otworzyć tę aplikację<br>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,a=r[0],p=r[1],f=r[2],c=0,s=[];c<a.length;c++)l=a[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var p=t[a];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var a=this.webpackJsonpplannaplan=this.webpackJsonpplannaplan||[],p=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=p;t()}([])</script><script src="/static/js/2.f941ed96.chunk.js"></script><script src="/static/js/main.993a2e72.chunk.js"></script></body></html>
|
25
build/logo.svg
Normal file
25
build/logo.svg
Normal file
@ -0,0 +1,25 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="200" height="200" viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #6d6e71;
|
||||
}
|
||||
|
||||
.cls-1, .cls-2, .cls-3 {
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
fill: #f9ca24;
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
fill: #1761a0;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path d="M22.000,156.000 L23.000,154.000 L24.000,153.000 L25.000,152.000 L26.000,151.000 L28.000,150.000 L33.000,150.000 L35.000,151.000 L36.000,152.000 L37.000,153.000 L38.000,154.000 L39.000,156.000 L39.000,161.000 L38.000,163.000 L37.000,164.000 L36.000,165.000 L35.000,166.000 L33.000,167.000 L28.000,167.000 L26.000,166.000 L25.000,165.000 L24.000,164.000 L23.000,163.000 L22.000,161.000 L22.000,156.000 ZM26.000,156.000 L27.000,155.000 L28.000,154.000 L33.000,154.000 L34.000,155.000 L35.000,156.000 L35.000,161.000 L34.000,162.000 L33.000,163.000 L28.000,163.000 L27.000,162.000 L26.000,161.000 L26.000,156.000 Z" class="cls-1"/>
|
||||
<path d="M10.000,75.000 L100.000,131.000 L190.000,75.000 L100.000,20.000 L10.000,75.000 Z" class="cls-2"/>
|
||||
<path d="M84.000,52.000 L86.000,54.000 L32.000,89.000 L32.000,153.000 L29.000,153.000 L29.000,88.000 L84.000,52.000 Z" class="cls-1"/>
|
||||
<path d="M45.000,102.000 L45.000,143.000 L100.000,180.000 L155.000,143.000 L155.000,102.000 L100.000,136.000 L45.000,102.000 Z" class="cls-3"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
13
build/manifest.json
Normal file
13
build/manifest.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"short_name": "PlanNaPlan",
|
||||
"name": "PlanNaPlan",
|
||||
"icons": [
|
||||
{
|
||||
"src": "logo.svg"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
42
build/precache-manifest.36f396009b702c50e7d07732240c69e5.js
Normal file
42
build/precache-manifest.36f396009b702c50e7d07732240c69e5.js
Normal file
@ -0,0 +1,42 @@
|
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "53d5f0388bed11f07f899035cb978454",
|
||||
"url": "/index.html"
|
||||
},
|
||||
{
|
||||
"revision": "4d480560b5cfff1aa5a8",
|
||||
"url": "/static/js/2.f941ed96.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "68ba00d5eb083746d913686923a3d904",
|
||||
"url": "/static/js/2.f941ed96.chunk.js.LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"revision": "209120e09e641f02e991",
|
||||
"url": "/static/js/main.993a2e72.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "c20b5bb64d57e939de77",
|
||||
"url": "/static/js/runtime-main.38573804.js"
|
||||
},
|
||||
{
|
||||
"revision": "6e9ee893741bee46177f72398176ad9e",
|
||||
"url": "/static/media/PL.6e9ee893.png"
|
||||
},
|
||||
{
|
||||
"revision": "b4dad47599118a028176ceb8bbbc7a02",
|
||||
"url": "/static/media/UK.b4dad475.png"
|
||||
},
|
||||
{
|
||||
"revision": "464128e7e5f72a712b7c752996e86b58",
|
||||
"url": "/static/media/close.464128e7.svg"
|
||||
},
|
||||
{
|
||||
"revision": "fa0d12ae1b4380d1515aed6c5e5cbc07",
|
||||
"url": "/static/media/search.fa0d12ae.svg"
|
||||
},
|
||||
{
|
||||
"revision": "4ba6e2a4136a8a9ce072ee9c1e403f3a",
|
||||
"url": "/static/media/user.4ba6e2a4.png"
|
||||
}
|
||||
]);
|
3
build/robots.txt
Normal file
3
build/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
39
build/service-worker.js
Normal file
39
build/service-worker.js
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Welcome to your Workbox-powered service worker!
|
||||
*
|
||||
* You'll need to register this file in your web app and you should
|
||||
* disable HTTP caching for this file too.
|
||||
* See https://goo.gl/nhQhGp
|
||||
*
|
||||
* The rest of the code is auto-generated. Please don't update this file
|
||||
* directly; instead, make changes to your Workbox build configuration
|
||||
* and re-run your build process.
|
||||
* See https://goo.gl/2aRDsh
|
||||
*/
|
||||
|
||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/precache-manifest.36f396009b702c50e7d07732240c69e5.js"
|
||||
);
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event.data && event.data.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting();
|
||||
}
|
||||
});
|
||||
|
||||
workbox.core.clientsClaim();
|
||||
|
||||
/**
|
||||
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
||||
* requests for URLs in the manifest.
|
||||
* See https://goo.gl/S9QRab
|
||||
*/
|
||||
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
||||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
||||
|
||||
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
|
||||
|
||||
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
||||
});
|
3
build/static/js/2.f941ed96.chunk.js
Normal file
3
build/static/js/2.f941ed96.chunk.js
Normal file
File diff suppressed because one or more lines are too long
58
build/static/js/2.f941ed96.chunk.js.LICENSE.txt
Normal file
58
build/static/js/2.f941ed96.chunk.js.LICENSE.txt
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
|
||||
/**
|
||||
* A better abstraction over CSS.
|
||||
*
|
||||
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
|
||||
* @website https://github.com/cssinjs/jss
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/** @license React v0.19.1
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
1
build/static/js/2.f941ed96.chunk.js.map
Normal file
1
build/static/js/2.f941ed96.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
2
build/static/js/main.993a2e72.chunk.js
Normal file
2
build/static/js/main.993a2e72.chunk.js
Normal file
File diff suppressed because one or more lines are too long
1
build/static/js/main.993a2e72.chunk.js.map
Normal file
1
build/static/js/main.993a2e72.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
2
build/static/js/runtime-main.38573804.js
Normal file
2
build/static/js/runtime-main.38573804.js
Normal file
@ -0,0 +1,2 @@
|
||||
!function(e){function r(r){for(var n,l,a=r[0],p=r[1],f=r[2],c=0,s=[];c<a.length;c++)l=a[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var p=t[a];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var a=this.webpackJsonpplannaplan=this.webpackJsonpplannaplan||[],p=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=p;t()}([]);
|
||||
//# sourceMappingURL=runtime-main.38573804.js.map
|
1
build/static/js/runtime-main.38573804.js.map
Normal file
1
build/static/js/runtime-main.38573804.js.map
Normal file
File diff suppressed because one or more lines are too long
BIN
build/static/media/PL.6e9ee893.png
Normal file
BIN
build/static/media/PL.6e9ee893.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
build/static/media/UK.b4dad475.png
Normal file
BIN
build/static/media/UK.b4dad475.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
1
build/static/media/close.464128e7.svg
Normal file
1
build/static/media/close.464128e7.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M38 12.83l-2.83-2.83-11.17 11.17-11.17-11.17-2.83 2.83 11.17 11.17-11.17 11.17 2.83 2.83 11.17-11.17 11.17 11.17 2.83-2.83-11.17-11.17z"/><path d="M0 0h48v48h-48z" fill="none"/></svg>
|
After Width: | Height: | Size: 297 B |
1
build/static/media/search.fa0d12ae.svg
Normal file
1
build/static/media/search.fa0d12ae.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg height="512px" id="Layer_1" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M344.5,298c15-23.6,23.8-51.6,23.8-81.7c0-84.1-68.1-152.3-152.1-152.3C132.1,64,64,132.2,64,216.3 c0,84.1,68.1,152.3,152.1,152.3c30.5,0,58.9-9,82.7-24.4l6.9-4.8L414.3,448l33.7-34.3L339.5,305.1L344.5,298z M301.4,131.2 c22.7,22.7,35.2,52.9,35.2,85c0,32.1-12.5,62.3-35.2,85c-22.7,22.7-52.9,35.2-85,35.2c-32.1,0-62.3-12.5-85-35.2 c-22.7-22.7-35.2-52.9-35.2-85c0-32.1,12.5-62.3,35.2-85c22.7-22.7,52.9-35.2,85-35.2C248.5,96,278.7,108.5,301.4,131.2z"/></svg>
|
After Width: | Height: | Size: 808 B |
BIN
build/static/media/user.4ba6e2a4.png
Normal file
BIN
build/static/media/user.4ba6e2a4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
2
package-lock.json
generated
2
package-lock.json
generated
@ -2062,7 +2062,7 @@
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
|
||||
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
|
||||
"dev": true
|
||||
}
|
||||
|
@ -1,35 +1,42 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, createContext, ReactNode } from 'react';
|
||||
import { User } from '../types';
|
||||
import axios from 'axios';
|
||||
|
||||
export interface CASContext {
|
||||
user: User | null;
|
||||
user?: User;
|
||||
logout: () => void;
|
||||
}
|
||||
|
||||
export const CASContext = React.createContext<CASContext | null>(null);
|
||||
export const CASContext = createContext<CASContext | undefined>(undefined);
|
||||
|
||||
export interface CASProviderProps {
|
||||
children: React.ReactNode;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const CASProvider = ({ children }: CASProviderProps) => {
|
||||
const [user, setUser] = useState<User | null>(null);
|
||||
|
||||
const [user, setUser] = useState<User | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
login();
|
||||
}, []);
|
||||
|
||||
function login() {
|
||||
const login = async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const ticket = urlParams.get('ticket');
|
||||
|
||||
if (!ticket) {
|
||||
redirectToCASLoginService();
|
||||
}
|
||||
if (ticket) {
|
||||
setUser({ ...user, ticket: ticket });
|
||||
try {
|
||||
if (!sessionStorage.getItem('userToken')) {
|
||||
const { data: token } = await axios.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`);
|
||||
sessionStorage.setItem('userToken', token);
|
||||
setUser({ ...user, token });
|
||||
}
|
||||
const token = sessionStorage.getItem('userToken');
|
||||
setUser({ ...user, token });
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function logout() {
|
||||
redirectToCASLogoutService();
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { useState, createContext, useEffect, ReactNode } from 'react';
|
||||
import React, { useState, createContext, useEffect, ReactNode, useContext } from 'react';
|
||||
import { Course, Group, Basket, GroupType } from '../types';
|
||||
import axios from 'axios';
|
||||
import { CASContext, CASProvider } from './CASProvider';
|
||||
|
||||
interface CourseContext {
|
||||
courses: Array<Course>;
|
||||
@ -10,7 +11,7 @@ interface CourseContext {
|
||||
deleteFromBasket: (id: number) => void;
|
||||
saveBasket: () => void;
|
||||
}
|
||||
export const coursesContext = createContext<CourseContext | null>(null);
|
||||
export const coursesContext = createContext<CourseContext | undefined>(undefined);
|
||||
|
||||
interface CoursesProviderProps {
|
||||
children: ReactNode;
|
||||
@ -21,6 +22,9 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
const [courses, setCourses] = useState<Array<Course>>([]);
|
||||
const [basket, setBasket] = useState<Array<Basket>>([]);
|
||||
|
||||
const CAS = useContext(CASContext)!;
|
||||
const token = CAS?.user?.token;
|
||||
|
||||
const addToBasket = (course: Course) => {
|
||||
const courseToBasket = {
|
||||
name: course.name,
|
||||
@ -30,15 +34,26 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
} as Basket;
|
||||
setBasket([...basket, courseToBasket]);
|
||||
};
|
||||
|
||||
const deleteFromBasket = (id: number) => setBasket(basket.filter((course) => course.id !== id));
|
||||
|
||||
const saveBasket = () => {
|
||||
// try {
|
||||
// axios.post(`${process.env.REACT_APP_API_URL}/api/v1/commisions/add`);
|
||||
// } catch (e) {
|
||||
// console.log(e);
|
||||
// }
|
||||
const saveBasket = async () => {
|
||||
try {
|
||||
let data = [7, 43, 54];
|
||||
let json = JSON.stringify(data);
|
||||
let post_data = { json_data: json };
|
||||
const ech = await axios.post<Array<number>>(
|
||||
`${process.env.REACT_APP_API_URL}/api/v1/commisions/add?`,
|
||||
[7, 43, 54],
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log('api response;', ech);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
console.log('saving to basket');
|
||||
};
|
||||
|
||||
@ -67,8 +82,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
lectures: groups.filter(({ type }) => type === GroupType.LECTURE),
|
||||
classes: groups.filter(({ type }) => type === GroupType.CLASS),
|
||||
})) as Array<Course>;
|
||||
console.log('courses mapped');
|
||||
console.log(courses);
|
||||
courses.sort((a: Course, b: Course) => (a.name > b.name ? 1 : -1));
|
||||
|
||||
setCourses(courses);
|
||||
|
@ -7,12 +7,12 @@ import { GlobalStyles } from './styles/GlobalStyles';
|
||||
|
||||
ReactDOM.render(
|
||||
<>
|
||||
<CoursesProvider>
|
||||
<CASProvider>
|
||||
<CASProvider>
|
||||
<CoursesProvider>
|
||||
<GlobalStyles />
|
||||
<App />
|
||||
</CASProvider>
|
||||
</CoursesProvider>
|
||||
</CoursesProvider>
|
||||
</CASProvider>
|
||||
</>,
|
||||
document.getElementById('root'),
|
||||
);
|
||||
|
@ -30,5 +30,5 @@ export interface Course {
|
||||
export interface User {
|
||||
name?: string;
|
||||
surname?: string;
|
||||
ticket: string | null;
|
||||
token: string | null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user