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
- Session not found. Please run appwrite l...
I have encounter an issue with appwrite CLI They asking for a login session but in the doc, it’s mention that only setup client with endpoint / api key is enou...
- ACTIVATE DEPLOYMENT PROBLEM...
It's not giving me the option to activate a deployment that says it's ready..
- general_unauthorized_scope
localhost oauth not working. general_unauthorized_scope error showing. { "message": "User (role: guests) missing scopes ([\"account\"])", "code": 401, ...