mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
- Added @analogjs/vite-plugin-angular and @analogjs/vitest-angular to devDependencies. - Updated @nx/vite to version 20.1.4. - Added @vitest/coverage-v8 and @vitest/ui to devDependencies. - Added jsdom to devDependencies. - Added vite and vitest to devDependencies. - Updated tsconfig.base.json to include new paths for shared libraries. - Created vitest.workspace.ts for vitest configuration. Refs: #5135
33 lines
1017 B
TypeScript
33 lines
1017 B
TypeScript
import { inject, Injectable } from '@angular/core';
|
|
import { ReturnService } from '@generated/swagger/inventory-api';
|
|
import { FetchReturnReasonParams, FetchReturnReasonSchema } from '../schemas';
|
|
import { ResponseArgsError, takeUntilAborted } from '@isa/common/data-access';
|
|
import { firstValueFrom } from 'rxjs';
|
|
import { KeyValueStringAndString } from '../models';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class RemissionReasonService {
|
|
#returnService = inject(ReturnService);
|
|
|
|
async fetchReturnReasons(
|
|
params: FetchReturnReasonParams,
|
|
abortSignal?: AbortSignal,
|
|
): Promise<KeyValueStringAndString[]> {
|
|
const { stockId } = FetchReturnReasonSchema.parse(params);
|
|
|
|
let req$ = this.#returnService.ReturnGetReturnReasons({ stockId });
|
|
|
|
if (abortSignal) {
|
|
req$ = req$.pipe(takeUntilAborted(abortSignal));
|
|
}
|
|
|
|
const res = await firstValueFrom(req$);
|
|
|
|
if (res.error) {
|
|
throw new ResponseArgsError(res);
|
|
}
|
|
|
|
return res.result as KeyValueStringAndString[];
|
|
}
|
|
}
|