refactor: everything to nuxt.js
This commit is contained in:
15
app/plugins/appwrite.client.ts
Normal file
15
app/plugins/appwrite.client.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useAuthStore } from '~/stores/auth';
|
||||
import { initAppwriteClient } from '~/utils/appwrite';
|
||||
|
||||
export default defineNuxtPlugin(async () => {
|
||||
const config = useRuntimeConfig();
|
||||
const endpoint = config.public.appwriteEndpoint as string;
|
||||
const projectId = config.public.appwriteProjectId as string;
|
||||
if (!endpoint || !projectId) {
|
||||
console.error('Appwrite config missing — check NUXT_PUBLIC_APPWRITE_ENDPOINT and NUXT_PUBLIC_APPWRITE_PROJECT_ID');
|
||||
return;
|
||||
}
|
||||
initAppwriteClient(endpoint, projectId);
|
||||
const authStore = useAuthStore();
|
||||
await authStore.init();
|
||||
});
|
||||
Reference in New Issue
Block a user