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
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...
- 500 simultaneous OAuth logins from the s...
Hi, I'd like to ask about rate limiting around Google OAuth login on Appwrite Cloud. **OVERVIEW** Service type: A PWA (web app) for members of a university clu...
- Suspicious access pattern detected when ...
Hello, I am having trouble restoring my project. In the past it worked with no problems, but today I get an error "Suspicious access pattern detected". How can ...