current https://cloud.appwrite.io/v1/account/sessions/current
account https://cloud.appwrite.io/v1/account
export const client=new Client()
client.setEndpoint(process.env.REACT_APP_ENDPOINT).setProject(process.env.REACT_APP_PROJECT)
export const account=new Account(client)
export const databases=new Databases(client)
export const storage=new Storage(client)```
what is the issue in this ?
1572 network request
on current and account
3000+
That's the account.getSession()
and account.get()
API calls. Where are you calling those in your code?
ev.preventDefault();
if(!useremail || !password) return;
const promise = account.createEmailSession(
useremail,
password
);
promise.then(function (response) {
setSessionId(response['$id']);
const _user = account.get();
_user.then(res => {
setCurrentUser(res);
navigate('/', {replace: true});
}).catch(err => {
console.log(err,"login page");
})
}, function (error) {
console.log(error,"login page function error");
});
}```
<h1>Login</h1>
<input className='a-input'
type="text"
placeholder="email"
value={useremail}
onChange={ev => setUseremail(ev.target.value)}/>
<input className='a-input'
type="password"
placeholder="password"
value={password}
onChange={ev => setPassword(ev.target.value)}/>
<button className='a-btn'>Login</button>
</form>```
try {
const _session=account.getSession('current')
_session.then(res=>{
setSessionId(res['$id'])
const promise=account.get()
promise.then(res=>{
setCurrentUser(res)
}).catch(err=>{
console.log(err);
})
}).catch(err=>{
console.log(err);
})
} catch (error) {
console.log(error);
}
})```
thanks @Steven I had forgot to add the dependency array
#solved
[SOLVED] infinite network requests are being made for current and account
Recommended threads
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...