diff --git a/appLab3/front/package-lock.json b/appLab3/front/package-lock.json index 06cadcd..b758a47 100644 --- a/appLab3/front/package-lock.json +++ b/appLab3/front/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", @@ -12750,6 +12751,15 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/appLab3/front/package.json b/appLab3/front/package.json index 9f17e8e..b22e448 100644 --- a/appLab3/front/package.json +++ b/appLab3/front/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", diff --git a/appLab3/front/src/App.js b/appLab3/front/src/App.js index 578f063..f8b6e74 100644 --- a/appLab3/front/src/App.js +++ b/appLab3/front/src/App.js @@ -88,8 +88,7 @@ function App() { const tryUseCookieToken = async () => { try { - const tokenCookie = document.cookie.split('; ').find(row => row.startsWith('jwt=')); - const token = tokenCookie ? tokenCookie.split('=')[1] : null; + const token = Cookies.get('jwt'); await axios.post('http://localhost:2999/token', { token: token diff --git a/appLab4/front/package-lock.json b/appLab4/front/package-lock.json index 06cadcd..b758a47 100644 --- a/appLab4/front/package-lock.json +++ b/appLab4/front/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", @@ -12750,6 +12751,15 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/appLab4/front/package.json b/appLab4/front/package.json index 9f17e8e..b22e448 100644 --- a/appLab4/front/package.json +++ b/appLab4/front/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", diff --git a/appLab4/front/src/App.js b/appLab4/front/src/App.js index 7f0ce70..643273f 100644 --- a/appLab4/front/src/App.js +++ b/appLab4/front/src/App.js @@ -135,8 +135,7 @@ function App() { const tryUseCookieToken = async () => { if (tokenWsRef.current) { - const tokenCookie = document.cookie.split('; ').find(row => row.startsWith('jwt=')); - const token = tokenCookie ? tokenCookie.split('=')[1] : null; + const token = Cookies.get('jwt'); tokenWsRef.current.send(JSON.stringify({ token: token diff --git a/appLab5/front/package-lock.json b/appLab5/front/package-lock.json index 06cadcd..b758a47 100644 --- a/appLab5/front/package-lock.json +++ b/appLab5/front/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", @@ -12750,6 +12751,15 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/appLab5/front/package.json b/appLab5/front/package.json index 9f17e8e..b22e448 100644 --- a/appLab5/front/package.json +++ b/appLab5/front/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", diff --git a/appLab5/front/src/App.js b/appLab5/front/src/App.js index b956961..9f6051b 100644 --- a/appLab5/front/src/App.js +++ b/appLab5/front/src/App.js @@ -124,9 +124,7 @@ function App() { }; const tryUseCookieToken = async () => { - const cookies = document.cookie.split('; '); - const tokenCookie = cookies.find(row => row.startsWith('jwt=')); - const token = tokenCookie ? tokenCookie.split('=')[1] : null; + const token = Cookies.get('jwt'); const query = ` mutation { diff --git a/appLab6/front/package-lock.json b/appLab6/front/package-lock.json index 06cadcd..b758a47 100644 --- a/appLab6/front/package-lock.json +++ b/appLab6/front/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", @@ -12750,6 +12751,15 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/appLab6/front/package.json b/appLab6/front/package.json index 9f17e8e..b22e448 100644 --- a/appLab6/front/package.json +++ b/appLab6/front/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.2", "axios": "^1.7.7", + "js-cookie": "^3.0.5", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", diff --git a/appLab6/front/src/App.js b/appLab6/front/src/App.js index 578f063..f8b6e74 100644 --- a/appLab6/front/src/App.js +++ b/appLab6/front/src/App.js @@ -88,8 +88,7 @@ function App() { const tryUseCookieToken = async () => { try { - const tokenCookie = document.cookie.split('; ').find(row => row.startsWith('jwt=')); - const token = tokenCookie ? tokenCookie.split('=')[1] : null; + const token = Cookies.get('jwt'); await axios.post('http://localhost:2999/token', { token: token