From fc35b7f2c3ffec260597304e7f6ba1397abce0e3 Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Tue, 8 Oct 2024 17:21:14 +0300 Subject: [PATCH] fix(IT): update router typings (#2802) * fix(IT): update router typings * fix: use WebComponentInterface instead of AfterEnterObserver --- packages/java/tests/spring/security/frontend/routes.ts | 8 ++++---- .../tests/spring/security/frontend/views/login-view.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/java/tests/spring/security/frontend/routes.ts b/packages/java/tests/spring/security/frontend/routes.ts index bde2c2b9a2..d236ae810c 100644 --- a/packages/java/tests/spring/security/frontend/routes.ts +++ b/packages/java/tests/spring/security/frontend/routes.ts @@ -1,4 +1,4 @@ -import { Commands, Context, Route } from '@vaadin/router'; +import { Commands, RouteContext, Route } from '@vaadin/router'; import { logout, isAuthenticated } from './auth'; import { appStore } from './stores/app-store'; import './views/main-view'; @@ -37,7 +37,7 @@ export const views: ViewRoute[] = [ path: 'private', component: 'private-view', title: 'Private', - action: async (_context: Context, commands: Commands) => { + action: async (_context: RouteContext, commands: Commands) => { if (!isAuthenticated()) { return commands.redirect('/login'); } @@ -49,7 +49,7 @@ export const views: ViewRoute[] = [ path: 'admin', component: 'admin-view', title: 'Admin View', - action: async (_context: Context, commands: Commands) => { + action: async (_context: RouteContext, commands: Commands) => { if (!appStore.isUserInRole('admin')) { return commands.redirect('/login'); } @@ -68,7 +68,7 @@ export const routes: ViewRoute[] = [ }, { path: '/logout', - action: async (_: Context, commands: Commands) => { + action: async (_: RouteContext, commands: Commands) => { await logout(); return commands.redirect('/'); }, diff --git a/packages/java/tests/spring/security/frontend/views/login-view.ts b/packages/java/tests/spring/security/frontend/views/login-view.ts index 55ac66fc8c..c48e73fd44 100644 --- a/packages/java/tests/spring/security/frontend/views/login-view.ts +++ b/packages/java/tests/spring/security/frontend/views/login-view.ts @@ -1,5 +1,5 @@ import { LoginResult } from '@vaadin/hilla-frontend'; -import { AfterEnterObserver, RouterLocation } from '@vaadin/router'; +import { RouterLocation, WebComponentInterface } from '@vaadin/router'; import '@vaadin/login/vaadin-login-overlay'; import { html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; @@ -7,7 +7,7 @@ import { login } from '../auth'; import { View } from './view'; @customElement('login-view') -export class LoginView extends View implements AfterEnterObserver { +export class LoginView extends View implements WebComponentInterface { @state() private error = false;