Solved the above error
But still the main issue persists
Have you edited the original permissions?
so remove this from the collection
wait let me do it
Ah then that is probably the issue
New error:
AppwriteException: Invalid permissions: Role "user" identifier value is invalid: Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char
What is your code your having with the imports?
import React, { useState } from 'react' import { v4 as uuidv4 } from 'uuid' import { databases } from '@/appwrite/appwrite' import { Permission, Role } from 'appwrite';
function TodoForm(userId) { const [todoItem, setTodoItem] = useState("") const data = { todoitem: todoItem }; console.log(data);
const handleSubmit = (e) => {
e.preventDefault()
const promise = databases.createDocument(
"DATABASE_ID",
"COLLECTION_ID",
uuidv4(),
data,
[
Permission.write(Role.user(userId)), // User can write this document
]
)
console.log(promise);
promise.then(
function (response) {
console.log(response);
// window.location.reload()
},
function (error) {
console.log(error);
// window.location.reload()
},
);
e.target.reset()
}
return (
<div className="max-w-7xl mx-auto mt-10 text-white">
<form
action=""
onSubmit={handleSubmit}
className="flex justify-center mb-10"
>
<input
type="text"
name=""
id=""
placeholder="Enter Todo"
className="border p-2 w-2/3 rounded-md text-black placeholder-gray-600"
onChange={(e) => {
setTodoItem(e.target.value)
}}
/>
<button
className="bg-pink-600 hover:bg-pink-700 p-2 text-white ml-2 rounded-md"
type="submit"
>
Add Todo
</button>
</form>
</div>
)
}
export default TodoForm
This is the code
check once
I think this needs to be update not write
I dont think permission write is a thing
there is
hmmm
Nvm ^_^
maybe log the userId?
see what it returns with
It returns the user id
Because here it says the user is wrong
But I'm just trying to add new todo
I sadly have not a clue why it returns that maybe wait for someone else?
Okay
Solved using <#1112060655072190464>
[SOLVED] Protect User's Data
Recommended threads
- RowList: The value of total is coming as...
RowList: The value of total is coming as a String, so it throws an error because it’s not parsed into an int. Error: TypeError: \"37\": type 'String' is not a ...
- Docker Compose MongoDB Setup
everythings work fine but the mongodb fails on startup everytime. log: ``` Generating random MongoDB keyfile... /bin/bash: line 9: : No such file or directory ...
- Auth broken after update from 1.8.0 to 1...
So ive been having issues creating, deleting or updating users on my appwrite instance after i updated from 1.8.0 to version 1.9.0. When trying to create a user...