finish environment of http server and test successfully
This commit is contained in:
16
src/client.ts
Normal file
16
src/client.ts
Normal 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,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
@@ -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) {
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user