多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
604 B

import { useNuxtApp } from "#app";
import { Api } from "nocodb-sdk";
import { defineNuxtPlugin } from "nuxt3/app";
export default defineNuxtPlugin((nuxtApp) => {
// Doing something with nuxtApp
const api = getApi(null, null);
// nuxtApp.provide("api", api);
return {
provide: {
api
}
};
});
export function getApi($store, $axios) {
const api = new Api({
baseURL: "http://localhost:8080",
headers: {
"xc-auth": $store?.state?.users?.token
}
});
if ($axios) {
// overwrite with nuxt axios instance
api.instance = $axios;
}
return api;
}