Please help I'm still getting CORS error of Appwrite instead enable platform hostname: localhost.
- 0
- Web
I'm following one Youtuber
which made this project
So basically you're copypasting?
not understanding also
because I want to learn.
appwrite
Tell me what do you want to achieve, the code you sent deppends on another file
If you have basic/intermeddiate js knowledge appwrite will be really easy to understand for you
I had sended you auth.js file code previous
The code you sent seems to check if the user is or not logged in, so that part should be this way simplified without overcomplicating:
try{
account.get();
//here you can make what you want if user is logged in
console.log("the user is already logged in");
}catch(error){
console.log("the user is logged out");
}```
Sincerely that video seems to do things "in the pro way" so they're more difficult to understand for beginners
async getCurrentUser() { try { account.get() console.log("the user is already logged in"); } catch (error) { console.log("Appwrite service :: getCurrentUser :: error", error) }
return null;
}
can I try this?
After taking a look into this, seems everything is correct. You're getting the error because the user is not logged in, so it should not be any problem or cause any inconveniences
Yes
now no error but signup form is not coming?
on clickin signup button
What's the signup button code?
function Signup() { const navigate = useNavigate() const [error, setError] = useState("") const dispatch = useDispatch() const {register, handleSubmit} = useForm()
const create = async (data) => {
setError("")
try {
const userData = await authService.createAccount(data)
if(userData) {
const userData = await authService.
getCurrentUser()
if(userData) dispatch(login(userData))
navigate("/")
}
} catch (error) {
setError(error.message)
}
}
is this correct?
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
Bro literally tagged him again π
I'm sorry on his behalf Steven π
Not sure what this does, this is the continuation of the first code you sent?
it's signup function code
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...