dmail section sidebar
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { type FC } from 'react'
|
||||
|
||||
const Domains: FC = () => {
|
||||
return (
|
||||
<div>Domains</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Domains
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import * as api from "../service/DmailService";
|
||||
|
||||
export const useGetDomains = () => {
|
||||
return useQuery({
|
||||
queryKey: ["dmail-domains"],
|
||||
queryFn: api.getDomains,
|
||||
});
|
||||
};
|
||||
|
||||
export const useActiveDomain = () => {
|
||||
return useMutation({
|
||||
mutationFn: api.activeDomain,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import axios from "../../../config/axios";
|
||||
import { ActiveDomainType } from "../types/Types";
|
||||
|
||||
export const getDomains = async () => {
|
||||
const { data } = await axios.get(`/dmail`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const activeDomain = async (params: ActiveDomainType) => {
|
||||
const { data } = await axios.patch(`/dmail/${params.id}/active`, params);
|
||||
return data;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export type ActiveDomainType = {
|
||||
isActive: boolean;
|
||||
id: string;
|
||||
};
|
||||
Reference in New Issue
Block a user