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
- Problem with Google Workspace at DNS Rec...
Hello, I bought a domain at Namecheap, and Google Workspace used to work there, but now that I switched from Custom DNS to Appwrite's nameservers, it doesn't w...
- change role of a team member in Appwrite
It's not possible to add/change roles of a team meber in Appwrite Frontend. When you click on a member of a team you get forwarded to the configuration page of ...
- 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...