w-lab-app/src/entities/chats/chatSettings.api.ts
gofnnp fe4ed88cf8 AW-503-additional-purchases
redirect when single payment, return_url & pageUrl
2025-08-30 19:16:01 +04:00

45 lines
1.1 KiB
TypeScript

"use client";
import { http } from "@/shared/api/httpClient";
import { API_ROUTES } from "@/shared/constants/api-routes";
import {
GetMyChatSettingsResponseSchema,
type IChatSettings,
type IGetMyChatSettingsResponse,
type IUpdateMyChatSettingsResponse,
UpdateMyChatSettingsResponseSchema,
} from "./types";
/**
* Fetch current user's chat settings (client-side)
*/
export const getMyChatSettings =
async (): Promise<IGetMyChatSettingsResponse> => {
return http.get<IGetMyChatSettingsResponse>(
API_ROUTES.getMyChatSettings(),
{
tags: ["profile", "chat-settings"],
schema: GetMyChatSettingsResponseSchema,
revalidate: 0,
}
);
};
/**
* Update current user's chat settings (client-side)
*/
export const updateMyChatSettings = async (
settings: IChatSettings
): Promise<IUpdateMyChatSettingsResponse> => {
return http.put<IUpdateMyChatSettingsResponse>(
API_ROUTES.updateMyChatSettings(),
settings,
{
tags: ["profile", "chat-settings"],
schema: UpdateMyChatSettingsResponseSchema,
revalidate: 0,
}
);
};