внедрил пресеты статусов и модульную архитектуру
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { httpClient } from '../../../core/infrastructure/httpClient';
|
||||
import type { User, StatusPreset } from '../../../core/domain/types';
|
||||
|
||||
export class StatusApi {
|
||||
static async getPresets(): Promise<StatusPreset[]> {
|
||||
return httpClient.request<StatusPreset[]>('/statuses/presets');
|
||||
}
|
||||
|
||||
static async setCustom(body: {
|
||||
emoji?: string | null;
|
||||
text?: string | null;
|
||||
expiresAt?: string | null;
|
||||
presetKey?: string | null;
|
||||
}): Promise<User> {
|
||||
return httpClient.request<User>('/statuses/custom', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
emoji: body.emoji ?? '',
|
||||
text: body.text ?? '',
|
||||
expiresAt: body.expiresAt ?? null,
|
||||
presetKey: body.presetKey ?? null,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
static async clear(): Promise<User> {
|
||||
return httpClient.request<User>('/statuses/', {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user