From 7f99dcac07c3f7c6c27177887959f91b332beb2b Mon Sep 17 00:00:00 2001 From: AmauryD Date: Thu, 12 Dec 2024 15:17:06 +0100 Subject: [PATCH] remove @action decorator and type route templates --- app/components/forms/register.gts | 7 ++----- app/routes/404.ts | 2 +- app/routes/application.ts | 2 +- app/routes/login.ts | 2 +- app/routes/register.ts | 4 ---- app/templates/404.gts | 9 ++++----- app/templates/application.gts | 4 +++- app/templates/forgot-password.gts | 13 ++++++------- app/templates/login.gts | 16 +++++++--------- app/templates/register.gts | 14 +++++--------- app/templates/reset-password.gts | 19 +++++++------------ app/utils/route-template.ts | 20 ++++++++++++++++++++ 12 files changed, 57 insertions(+), 55 deletions(-) create mode 100644 app/utils/route-template.ts diff --git a/app/components/forms/register.gts b/app/components/forms/register.gts index b816c61..09daac1 100644 --- a/app/components/forms/register.gts +++ b/app/components/forms/register.gts @@ -3,7 +3,6 @@ import type { RegisterChangeset } from 'ember-boilerplate/changesets/register'; import TpkForm from '@triptyk/ember-input-validation/components/tpk-form'; import type validationsRegister from 'ember-boilerplate/validations/register'; import Component from '@glimmer/component'; -import { action } from '@ember/object'; export interface FormsRegisterSignature { Args: { @@ -19,13 +18,11 @@ export interface FormsRegisterSignature { } export default class FormsRegister extends Component { - @action - setBirthdate(date: unknown) { + setBirthdate = (date: unknown) => { this.args.changeset.set('birthDate', date as Date); } - @action - selectCategory(category: unknown) { + selectCategory = (category: unknown) => { this.args.changeset.set('category', category as string); } diff --git a/app/routes/404.ts b/app/routes/404.ts index f8006c3..2ce5d42 100644 --- a/app/routes/404.ts +++ b/app/routes/404.ts @@ -1,3 +1,3 @@ import Route from '@ember/routing/route'; -export default class NotFound extends Route {} +export default class NotFoundRoute extends Route {} diff --git a/app/routes/application.ts b/app/routes/application.ts index ca91278..8acb054 100644 --- a/app/routes/application.ts +++ b/app/routes/application.ts @@ -9,7 +9,7 @@ import type { IntlService } from 'ember-intl'; import type SessionService from 'ember-simple-auth/services/session'; import { setupWorker } from 'msw/browser'; -export default class Application extends Route { +export default class ApplicationRoute extends Route { @service declare session: SessionService; @service declare currentUser: CurrentUserService; @service declare intl: IntlService; diff --git a/app/routes/login.ts b/app/routes/login.ts index 9eafd0d..db5835b 100644 --- a/app/routes/login.ts +++ b/app/routes/login.ts @@ -3,7 +3,7 @@ import { service } from '@ember/service'; import type SessionService from 'ember-simple-auth/services/session'; -export default class Login extends Route { +export default class LoginRoute extends Route { @service declare session: SessionService; beforeModel() { diff --git a/app/routes/register.ts b/app/routes/register.ts index b9ab6e5..a366e77 100644 --- a/app/routes/register.ts +++ b/app/routes/register.ts @@ -1,9 +1,5 @@ import Route from '@ember/routing/route'; -export interface RegisterRouteParams {} - -export type RegisterRouteModel = Resolved>; - export default class RegisterRoute extends Route { model() { return {}; diff --git a/app/templates/404.gts b/app/templates/404.gts index f4cb0a4..0340f72 100644 --- a/app/templates/404.gts +++ b/app/templates/404.gts @@ -1,15 +1,14 @@ import Component from '@glimmer/component'; import { on } from '@ember/modifier'; -import { action } from '@ember/object'; - import t from 'ember-intl/helpers/t'; import RouteTemplate from 'ember-route-template'; +import type { RouteTemplateSignature } from 'ember-boilerplate/utils/route-template'; +import type NotFoundRoute from 'ember-boilerplate/routes/404'; export interface NotFoundRouteComponentSignature {} -class NotFoundRouteComponent extends Component { - @action - comeback() { +class NotFoundRouteComponent extends Component> { + comeback = () => { window.history.back(); } diff --git a/app/templates/application.gts b/app/templates/application.gts index 83a299e..54963cd 100644 --- a/app/templates/application.gts +++ b/app/templates/application.gts @@ -7,8 +7,10 @@ import HeadLayout from 'ember-cli-head/components/head-layout'; import RouteTemplate from 'ember-route-template'; import type FlashMessageService from 'ember-cli-flash/services/flash-messages'; +import type { RouteTemplateSignature } from 'ember-boilerplate/utils/route-template'; +import type ApplicationRoute from 'ember-boilerplate/routes/application'; -class ApplicationRouteComponent extends Component { +class ApplicationRouteComponent extends Component> { @service declare flashMessages: FlashMessageService;