This commit is contained in:
parent
0096851894
commit
cacd36a854
|
@ -58,9 +58,12 @@ const onResponseError = (error) => {
|
|||
break;
|
||||
}
|
||||
|
||||
if (session.isLoggedIn && response.status === 401) {
|
||||
if (session.isLoggedIn() && response.status === 401) {
|
||||
session.destroy();
|
||||
Router.push({ path: '/login' });
|
||||
} else if(!session.isLoggedIn())
|
||||
{
|
||||
message = 'login.loginError';
|
||||
}
|
||||
|
||||
Notify.create({
|
||||
|
|
|
@ -48,25 +48,29 @@ const password = ref('');
|
|||
const keepLogin = ref(true);
|
||||
|
||||
async function onSubmit() {
|
||||
const { data } = await axios.post('Accounts/login', {
|
||||
user: username.value,
|
||||
password: password.value,
|
||||
});
|
||||
try {
|
||||
const { data } = await axios.post('Accounts/login', {
|
||||
user: username.value,
|
||||
password: password.value,
|
||||
});
|
||||
|
||||
if (!data) return;
|
||||
if (!data) return;
|
||||
|
||||
await session.login(data.token, keepLogin.value);
|
||||
await session.login(data.token, keepLogin.value);
|
||||
|
||||
quasar.notify({
|
||||
message: t('login.loginSuccess'),
|
||||
type: 'positive',
|
||||
});
|
||||
quasar.notify({
|
||||
message: t('login.loginSuccess'),
|
||||
type: 'positive',
|
||||
});
|
||||
|
||||
const currentRoute = router.currentRoute.value;
|
||||
if (currentRoute.query && currentRoute.query.redirect) {
|
||||
router.push(currentRoute.query.redirect);
|
||||
} else {
|
||||
router.push({ name: 'Dashboard' });
|
||||
const currentRoute = router.currentRoute.value;
|
||||
if (currentRoute.query && currentRoute.query.redirect) {
|
||||
router.push(currentRoute.query.redirect);
|
||||
} else {
|
||||
router.push({ name: 'Dashboard' });
|
||||
}
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -43,13 +43,13 @@ describe('ClaimPhoto', () => {
|
|||
cy.get(
|
||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
||||
).click();
|
||||
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
||||
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||
|
||||
cy.get(
|
||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
||||
).click();
|
||||
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
||||
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="cypress" />
|
||||
xdescribe('TicketBoxing', () => {
|
||||
describe('TicketBoxing', () => {
|
||||
beforeEach(() => {
|
||||
const ticketId = 1;
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -26,9 +26,9 @@ xdescribe('TicketBoxing', () => {
|
|||
},
|
||||
['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4']
|
||||
).as('getVideoList');
|
||||
cy.get('.q-list > :nth-child(3)').click();
|
||||
cy.get('.q-list').eq(3).find('.q-item').eq(2).click();
|
||||
|
||||
cy.get('.q-list > :nth-child(1)').should('be.visible');
|
||||
cy.get('.q-list > :nth-child(2)').should('be.visible');
|
||||
cy.get('.q-list').eq(3).find('.q-item').eq(0).find('.q-range');
|
||||
cy.get('.q-list').eq(3).find('.q-item').eq(1).find('.q-select');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,7 +12,10 @@ describe('WorkerList', () => {
|
|||
});
|
||||
|
||||
it('should open the worker summary', () => {
|
||||
cy.get('div[class="q-item__section column q-item__section--side justify-center q-pa-md"]').eq(0).click();
|
||||
cy.get('div.text-h6')
|
||||
.parentsUntil('div.q-card')
|
||||
.find('div.q-card__actions')
|
||||
.find('button').first().click();
|
||||
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '1110 - Jessica Jones');
|
||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
||||
|
|
|
@ -6,10 +6,10 @@ describe('WorkerSummary', () => {
|
|||
});
|
||||
|
||||
it('should load worker summary', () => {
|
||||
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '19 - salesBoss');
|
||||
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '19 - salesBoss salesBoss');
|
||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
||||
cy.get('div[class="q-item__section column q-item__section--main justify-center"]').eq(0).should('have.text', 'NamesalesBossNick');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { vi, describe, expect, it } from 'vitest';
|
||||
import { Notify } from 'quasar';
|
||||
import { onRequest, onResponseError } from 'src/boot/axios';
|
||||
import { Notify } from 'quasar'
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
vi.mock('src/composables/useSession', () => ({
|
||||
useSession: () => ({
|
||||
getToken: () => 'DEFAULT_TOKEN'
|
||||
}),
|
||||
getToken: () => 'DEFAULT_TOKEN',
|
||||
isLoggedIn: () => vi.fn(),
|
||||
destroy: () => vi.fn(),
|
||||
})
|
||||
}));
|
||||
|
||||
vi.mock('src/router', () => ({}));
|
||||
|
||||
describe('Axios boot', () => {
|
||||
|
||||
describe('onRequest()', async () => {
|
||||
|
|
Loading…
Reference in New Issue