CipherStreamWeb converted to use Vite

This commit is contained in:
2025-08-13 23:31:29 -04:00
parent 70f9adb930
commit c9bddfa74d
120 changed files with 13931 additions and 3 deletions

View 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;
}
});
}