MME-34 Remove @tanstack/angular dependency.
This commit is contained in:
parent
4a271ecd10
commit
7887295c34
@ -32,7 +32,6 @@
|
|||||||
"@angular/router": "^21.0.0",
|
"@angular/router": "^21.0.0",
|
||||||
"@fortawesome/angular-fontawesome": "^4.0.0",
|
"@fortawesome/angular-fontawesome": "^4.0.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
||||||
"@tanstack/angular-query-experimental": "^5.90.16",
|
|
||||||
"ngx-toastr": "^20.0.5",
|
"ngx-toastr": "^20.0.5",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
|
|||||||
@ -3,8 +3,6 @@ import { provideRouter } from '@angular/router';
|
|||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||||
import { authInterceptor } from './shared/interceptors/auth.interceptor';
|
import { authInterceptor } from './shared/interceptors/auth.interceptor';
|
||||||
import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental';
|
|
||||||
import { withDevtools } from '@tanstack/angular-query-experimental/devtools';
|
|
||||||
import { provideToastr } from 'ngx-toastr';
|
import { provideToastr } from 'ngx-toastr';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
@ -12,16 +10,6 @@ export const appConfig: ApplicationConfig = {
|
|||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
provideRouter(routes),
|
provideRouter(routes),
|
||||||
provideHttpClient(withInterceptors([authInterceptor])),
|
provideHttpClient(withInterceptors([authInterceptor])),
|
||||||
provideTanStackQuery(
|
|
||||||
new QueryClient({
|
|
||||||
defaultOptions: {
|
|
||||||
queries: {
|
|
||||||
experimental_prefetchInRender: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
withDevtools(),
|
|
||||||
),
|
|
||||||
provideToastr(),
|
provideToastr(),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { EnterRecipeData } from './enter-recipe-data';
|
import { EnterRecipeData } from './enter-recipe-data';
|
||||||
import { provideQueryClient, QueryClient } from '@tanstack/angular-query-experimental';
|
|
||||||
import { inputBinding } from '@angular/core';
|
import { inputBinding } from '@angular/core';
|
||||||
import { RecipeDraftViewModel } from '../../../../shared/models/RecipeDraftView.model';
|
import { RecipeDraftViewModel } from '../../../../shared/models/RecipeDraftView.model';
|
||||||
|
|
||||||
@ -9,17 +8,9 @@ describe('EnterRecipeData', () => {
|
|||||||
let fixture: ComponentFixture<EnterRecipeData>;
|
let fixture: ComponentFixture<EnterRecipeData>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const queryClient = new QueryClient({
|
|
||||||
defaultOptions: {
|
|
||||||
queries: {
|
|
||||||
retry: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [EnterRecipeData],
|
imports: [EnterRecipeData],
|
||||||
providers: [provideQueryClient(queryClient)],
|
providers: [],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(EnterRecipeData, {
|
fixture = TestBed.createComponent(EnterRecipeData, {
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { RecipeEditForm } from './recipe-edit-form';
|
import { RecipeEditForm } from './recipe-edit-form';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { inputBinding } from '@angular/core';
|
import { inputBinding } from '@angular/core';
|
||||||
import { UserInfoView } from '../../models/UserInfoView.model';
|
import { UserInfoView } from '../../models/UserInfoView.model';
|
||||||
import { RecipeDraftViewModel } from '../../models/RecipeDraftView.model';
|
import { RecipeDraftViewModel } from '../../models/RecipeDraftView.model';
|
||||||
import { provideQueryClient, QueryClient } from '@tanstack/angular-query-experimental';
|
|
||||||
import { ImageService } from '../../services/ImageService';
|
import { ImageService } from '../../services/ImageService';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { SliceView, SliceViewMeta } from '../../models/SliceView.model';
|
import { SliceView, SliceViewMeta } from '../../models/SliceView.model';
|
||||||
@ -16,14 +14,6 @@ describe('RecipeEditForm', () => {
|
|||||||
let fixture: ComponentFixture<RecipeEditForm>;
|
let fixture: ComponentFixture<RecipeEditForm>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const queryClient = new QueryClient({
|
|
||||||
defaultOptions: {
|
|
||||||
queries: {
|
|
||||||
retry: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const imageServiceMock = {
|
const imageServiceMock = {
|
||||||
getOwnedImagesCount: vi.fn(() => of(0)),
|
getOwnedImagesCount: vi.fn(() => of(0)),
|
||||||
getOwnedImageViewsWithBlobUrls: vi.fn(() =>
|
getOwnedImageViewsWithBlobUrls: vi.fn(() =>
|
||||||
@ -38,7 +28,6 @@ describe('RecipeEditForm', () => {
|
|||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [RecipeEditForm],
|
imports: [RecipeEditForm],
|
||||||
providers: [
|
providers: [
|
||||||
provideQueryClient(queryClient),
|
|
||||||
{
|
{
|
||||||
provide: ImageService,
|
provide: ImageService,
|
||||||
useValue: imageServiceMock,
|
useValue: imageServiceMock,
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { inject, Injectable, Signal, signal } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { LoginView } from '../models/LoginView.model';
|
import { LoginView } from '../models/LoginView.model';
|
||||||
import { firstValueFrom, Observable, tap } from 'rxjs';
|
import { firstValueFrom, Observable, tap } from 'rxjs';
|
||||||
import { QueryClient } from '@tanstack/angular-query-experimental';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { EndpointService } from './EndpointService';
|
import { EndpointService } from './EndpointService';
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ export class AuthService {
|
|||||||
public readonly username: Signal<string | null> = this._username;
|
public readonly username: Signal<string | null> = this._username;
|
||||||
|
|
||||||
private readonly http = inject(HttpClient);
|
private readonly http = inject(HttpClient);
|
||||||
private readonly queryClient = inject(QueryClient);
|
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly endpointService = inject(EndpointService);
|
private readonly endpointService = inject(EndpointService);
|
||||||
|
|
||||||
@ -33,7 +31,6 @@ export class AuthService {
|
|||||||
);
|
);
|
||||||
this._accessToken.set(loginView.accessToken);
|
this._accessToken.set(loginView.accessToken);
|
||||||
this._username.set(loginView.username);
|
this._username.set(loginView.username);
|
||||||
await this.queryClient.invalidateQueries();
|
|
||||||
return loginView;
|
return loginView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +39,6 @@ export class AuthService {
|
|||||||
this._username.set(null);
|
this._username.set(null);
|
||||||
this._accessToken.set(null);
|
this._accessToken.set(null);
|
||||||
await this.router.navigate(['/']);
|
await this.router.navigate(['/']);
|
||||||
await this.queryClient.invalidateQueries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh(): Observable<LoginView> {
|
public refresh(): Observable<LoginView> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user