diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a679cdfc..dbf6bdcc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2414.01] - 2024-04-04 + +### Added + +### Changed + +### Fixed + ## [2400.01] - 2024-01-04 ### Added diff --git a/package.json b/package.json index beae0b7b9..a35020b66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.12.0", + "version": "24.14.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", diff --git a/src/composables/useSession.js b/src/composables/useSession.js index 580efbdf8..45d439b46 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -2,9 +2,11 @@ import { useState } from './useState'; import { useRole } from './useRole'; import { useUserConfig } from './useUserConfig'; import axios from 'axios'; - +import useNotify from './useNotify'; export function useSession() { + const { notify } = useNotify(); + function getToken() { const localToken = localStorage.getItem('token'); const sessionToken = sessionStorage.getItem('token'); @@ -27,38 +29,28 @@ export function useSession() { sessionStorage.setItem('tokenMultimedia', data.tokenMultimedia); } } - + async function destroyToken(url, storage, key) { + if (storage.getItem(key)) { + try { + await axios.post(url, null, { + headers: { Authorization: storage.getItem(key) }, + }); + } catch (error) { + notify('errors.statusUnauthorized', 'negative'); + } finally { + storage.removeItem(key); + } + } + } async function destroy() { - if (localStorage.getItem('tokenMultimedia')){ - await axios.post('VnUsers/logoutMultimedia', null, { - headers: {Authorization: localStorage.getItem('tokenMultimedia') } - }); - localStorage.removeItem('tokenMultimedia') - + const tokens = { + tokenMultimedia: 'Accounts/logout', + token: 'VnUsers/logout', + }; + for (const [key, url] of Object.entries(tokens)) { + await destroyToken(url, localStorage, key); + await destroyToken(url, sessionStorage, key); } - if (localStorage.getItem('token')){ - await axios.post('VnUsers/logout', null, { - headers: {Authorization: localStorage.getItem('token') } - }); - localStorage.removeItem('token') - } - - - if (sessionStorage.getItem('tokenMultimedia')){ - await axios.post('VnUsers/logoutMultimedia', null, { - headers: {Authorization: sessionStorage.getItem('tokenMultimedia') } - }); - sessionStorage.removeItem('tokenMultimedia') - - } - if (sessionStorage.getItem('token')){ - await axios.post('VnUsers/logout', null, { - headers: {Authorization: sessionStorage.getItem('token') } - }); - sessionStorage.removeItem('token') - } - - const { setUser } = useState(); diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index 80757c57b..7ffd84e39 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -271,7 +271,7 @@ function openDialog(dmsId) { > diff --git a/test/cypress/integration/VnLocation.spec.js b/test/cypress/integration/VnLocation.spec.js index 02b924e4d..5892e3ad5 100644 --- a/test/cypress/integration/VnLocation.spec.js +++ b/test/cypress/integration/VnLocation.spec.js @@ -40,9 +40,9 @@ describe('VnLocation', () => { cy.waitForElement('.q-card'); }); - it('Show all options', function() { + it('Show locations options', function() { cy.get(inputLocation).click(); - cy.get(locationOptions).should('have.length', 1); + cy.get(locationOptions).should('have.length', 5); }); }); }) diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js index b5c57f920..bc4b2383e 100644 --- a/test/cypress/integration/worker/workerList.spec.js +++ b/test/cypress/integration/worker/workerList.spec.js @@ -16,7 +16,7 @@ describe('WorkerList', () => { it('should open the worker summary', () => { cy.openListSummary(0); cy.get('.summaryHeader div').should('have.text', '1110 - Jessica Jones'); - cy.get('.summary .header').eq(0).invoke('text').should('include', 'Basic data'); - cy.get('.summary .header').eq(1).should('have.text', 'User data'); + cy.get('.summary .header-link').eq(0).invoke('text').should('include', 'Basic data'); + cy.get('.summary .header-link').eq(1).should('have.text', 'User data'); }); }); diff --git a/test/vitest/__tests__/components/Paginate.spec.js b/test/vitest/__tests__/components/Paginate.spec.js index 2a22ce438..cf5e5d2ea 100644 --- a/test/vitest/__tests__/components/Paginate.spec.js +++ b/test/vitest/__tests__/components/Paginate.spec.js @@ -49,6 +49,8 @@ describe('VnPaginate', () => { ], }); vm.arrayData.hasMoreData.value = true; + await vm.$nextTick(); + vm.store.data = [ { id: 1, name: 'Tony Stark' }, { id: 2, name: 'Jessica Jones' },