CipherStreamWeb converted to use Vite
This commit is contained in:
40
src/hooks/polysubstitution/TrifidHooks.ts
Normal file
40
src/hooks/polysubstitution/TrifidHooks.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { type CipherInfo } from "@/models/CipherInfo";
|
||||
import type { TrifidProps } from "@/models/PolySubstitutionProps";
|
||||
import api from "@/util/AxiosUtil";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
|
||||
|
||||
export function useGetTrifidInfo(){
|
||||
return useQuery({
|
||||
queryKey: [ "Trifid", "Info" ],
|
||||
queryFn: async () => {
|
||||
const response = await api.get(`${import.meta.env.VITE_API_URL}/trifid`);
|
||||
|
||||
return response.data as CipherInfo;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function useEncodeTrifid(){
|
||||
return useMutation({
|
||||
mutationKey: [ "Trifid", "Encode" ],
|
||||
scope: { id: "Trifid Encode" },
|
||||
mutationFn: async (props: TrifidProps) => {
|
||||
const response = await api.post(`${import.meta.env.VITE_API_URL}/trifid/encode`, props);
|
||||
|
||||
return response.data as TrifidProps;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function useDecodeTrifid(){
|
||||
return useMutation({
|
||||
mutationKey: [ "Trifid", "Decode" ],
|
||||
scope: { id: "Trifid Decode" },
|
||||
mutationFn: async (props: TrifidProps) => {
|
||||
const response = await api.post(`${import.meta.env.VITE_API_URL}/trifid/decode`, props);
|
||||
|
||||
return response.data as TrifidProps;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user