2024-03-27 11:31:54 +00:00
|
|
|
import { Entities } from 'soapbox/entity-store/entities';
|
|
|
|
import { useCreateEntity } from 'soapbox/entity-store/hooks';
|
|
|
|
import { useApi } from 'soapbox/hooks';
|
|
|
|
import { domainSchema } from 'soapbox/schemas';
|
|
|
|
|
|
|
|
interface CreateDomainParams {
|
|
|
|
domain: string;
|
|
|
|
public: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
const useCreateDomain = () => {
|
|
|
|
const api = useApi();
|
|
|
|
|
|
|
|
const { createEntity, ...rest } = useCreateEntity([Entities.DOMAINS], (params: CreateDomainParams) =>
|
2024-10-09 06:46:46 +00:00
|
|
|
api.post('/api/v1/pleroma/admin/domains', { json: params }), { schema: domainSchema });
|
2024-03-27 11:31:54 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
createDomain: createEntity,
|
|
|
|
...rest,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export { useCreateDomain, type CreateDomainParams };
|