finish environment of http server and test successfully

This commit is contained in:
2025-03-20 12:42:32 +08:00
parent 4447fbb70e
commit 53eeac5272
10 changed files with 52 additions and 32 deletions

16
src/client.ts Normal file
View File

@@ -0,0 +1,16 @@
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../server/router';
export const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3002',
// You can pass any HTTP headers you wish here
async headers() {
return {
authorization: document.cookie,
};
},
}),
],
});

View File

@@ -22,6 +22,8 @@
</template>
<script lang="ts" setup>
import { client } from '@/client';
var bitstream = null;
function handleFileChange(event: Event): void {
@@ -38,8 +40,10 @@ function handleFileChange(event: Event): void {
console.log(bitstream);
}
function uploadBitStream() {
async function uploadBitStream() {
const serverStatus = await client.api.status.query();
console.log(serverStatus)
}
function checkFileType(file: File) {

View File

@@ -6,7 +6,5 @@ import { createPinia } from 'pinia'
import App from '@/App.vue'
import router from './router'
const app = createApp(App).use(router).use(createPinia()).mount('#app')
console.log()