Estoy intentado crear un login siguiendo la documentación, usando un cdn pero me sale este error:
script.js:2 Uncaught SyntaxError: The requested module 'https://cdn.jsdelivr.net/npm/appwrite@13.0.1' does not provide an export named 'Account' (at script.js:2:19)
No se como vincular correctamente el appwrite con mis archivos de js para poder usarlos, ayuda por favor.
English please?
And what's your code?
This is my js:
import { Client, Account, ID } from 'https://cdn.jsdelivr.net/npm/appwrite@13.0.1';
export const client = new Client();
client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('ID') // Your project ID ;
// Función para registrar un nuevo usuario export function register() { const email = document.getElementById('registerEmail').value; const password = document.getElementById('registerPassword').value;
const promise = account.create(email, password, '');
promise.then(function (response) {
console.log('Usuario registrado:', response);
alert('Usuario registrado con éxito');
}, function (error) {
console.error('Error al registrar usuario:', error);
alert('Error al registrar usuario');
});
and it seems that this is wrong: import { Client, Account, ID } from 'https://cdn.jsdelivr.net/npm/appwrite@13.0.1';
Hola! parece ser que no has creado una variable para la cuenta (Account)
Hello! looks like that you have not created a variable for the account
Tienes que crear una variable así, para que la parte de la cuenta sea reconocida:
const account = new Account(client);
You need to create a veriable like this, to make the account part to be recognized:
ohh vale, muchisimas gracias, lo voy a probar
De nada! Dime si eso soluciona tu problema o no.
Your welcome! Tell me if that solves your issue or not.
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...