Hooked up test call from frontend!

This commit is contained in:
Gregory Schier
2024-01-29 20:50:43 -08:00
parent eecb3fbc7f
commit 89e5d4f235
9 changed files with 821 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
import { invoke } from '@tauri-apps/api';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { attachConsole } from 'tauri-plugin-log-api';
@@ -10,6 +11,20 @@ import { setAppearanceOnDocument } from './lib/theme/window';
import { appWindow } from '@tauri-apps/api/window';
import { type } from '@tauri-apps/api/os';
try {
const services: any = await invoke('grpc_reflect', { endpoint: 'http://localhost:50051' });
console.log('SERVICES', services);
const response = await invoke('grpc_call_unary', {
endpoint: 'http://localhost:50051',
service: services[0].name,
method: services[0].methods[0].name,
message: '{"name": "Greg"}',
});
console.log('RESPONSE', response);
} catch (err) {
console.log('ERROR', err);
}
// Hide decorations here because it doesn't work in Rust for some reason (bug?)
const osType = await type();
if (osType !== 'Darwin') {