mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Template Tag Function Editor (#67)

This commit is contained in:
14
src-web/hooks/useParseTemplate.ts
Normal file
14
src-web/hooks/useParseTemplate.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import type { Tokens } from '../gen/Tokens';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
|
||||
export function useParseTemplate(template: string) {
|
||||
return useQuery<Tokens>({
|
||||
queryKey: ['parse_template', template],
|
||||
queryFn: () => parseTemplate(template),
|
||||
});
|
||||
}
|
||||
|
||||
export async function parseTemplate(template: string): Promise<Tokens> {
|
||||
return invokeCmd('cmd_parse_template', { template });
|
||||
}
|
||||
Reference in New Issue
Block a user