Skip to content

Commit

Permalink
js cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Hummel009 committed Dec 6, 2024
1 parent 9c35fad commit 47469b6
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 9 deletions.
10 changes: 10 additions & 0 deletions appLab3/front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions appLab3/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions appLab3/front/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions appLab4/front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions appLab4/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions appLab4/front/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions appLab5/front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions appLab5/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions appLab5/front/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions appLab6/front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions appLab6/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions appLab6/front/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 47469b6

Please sign in to comment.