Skip to content

Commit

Permalink
fix(IT): update router typings (#2802)
Browse files Browse the repository at this point in the history
* fix(IT): update router typings

* fix: use WebComponentInterface instead of AfterEnterObserver
  • Loading branch information
Lodin authored Oct 8, 2024
1 parent ee782b2 commit fc35b7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/java/tests/spring/security/frontend/routes.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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');
}
Expand All @@ -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');
}
Expand All @@ -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('/');
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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';
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;

Expand Down

0 comments on commit fc35b7f

Please sign in to comment.