mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 12:30:06 +02:00
refactor api controller to internalize server fetch
This commit is contained in:
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
||||
import i18n from '/@/i18n/i18n';
|
||||
import { ssType } from '/@/shared/api/subsonic/subsonic-types';
|
||||
import { toast } from '/@/shared/components/toast/toast';
|
||||
import { ServerListItem } from '/@/shared/types/domain-types';
|
||||
import { ServerListItemWithCredential } from '/@/shared/types/domain-types';
|
||||
|
||||
const c = initContract();
|
||||
|
||||
@@ -288,7 +288,7 @@ const silentlyTransformResponse = (data: any) => {
|
||||
};
|
||||
|
||||
export const ssApiClient = (args: {
|
||||
server: null | ServerListItem;
|
||||
server: null | ServerListItemWithCredential;
|
||||
signal?: AbortSignal;
|
||||
silent?: boolean;
|
||||
url?: string;
|
||||
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
} from '/@/shared/api/subsonic/subsonic-types';
|
||||
import {
|
||||
AlbumListSort,
|
||||
ControllerEndpoint,
|
||||
GenreListSort,
|
||||
InternalControllerEndpoint,
|
||||
LibraryItem,
|
||||
PlaylistListSort,
|
||||
Song,
|
||||
@@ -51,7 +51,7 @@ const MAX_SUBSONIC_ITEMS = 500;
|
||||
// A trick to skip ahead 10x
|
||||
const SUBSONIC_FAST_BATCH_SIZE = MAX_SUBSONIC_ITEMS * 10;
|
||||
|
||||
export const SubsonicController: ControllerEndpoint = {
|
||||
export const SubsonicController: InternalControllerEndpoint = {
|
||||
addToPlaylist: async ({ apiClientProps, body, query }) => {
|
||||
const res = await ssApiClient(apiClientProps).updatePlaylist({
|
||||
query: {
|
||||
|
||||
Reference in New Issue
Block a user