Update db name and id/ remove error state

This commit is contained in:
Ebenezer Don
2024-11-18 15:26:09 +00:00
parent 88974748d3
commit 2a2d129b02

View File

@@ -9,8 +9,8 @@ To store your ideas, you need to create a database first.
1. Go to the Databases section in your Appwrite Console
2. Click *Create Database*
3. Give it a name (e.g. "ideas-tracker")
4. Save the database ID as you'll need it later
3. Give it a name and ID. For this tutorial, we'll use `Ideas Tracker` as the name and `ideas-tracker` as the ID.
4. You'll need to remember the database ID as you'll need it later.
# Create collection {% #create-collection %}
In Appwrite, data is stored as a collection of documents. Create a collection in the [Appwrite Console](https://cloud.appwrite.io/) to store our ideas.
@@ -64,7 +64,6 @@ export function useIdeas() {
export function IdeasProvider(props) {
const [ideas, setIdeas] = useState([]);
const [error, setError] = useState(null);
async function add(idea) {
try {
@@ -76,7 +75,7 @@ export function IdeasProvider(props) {
);
setIdeas((ideas) => [response, ...ideas].slice(0, 10));
} catch (err) {
setError(err.message);
console.log(err) // handle error or show user a message
}
}
@@ -86,7 +85,7 @@ export function IdeasProvider(props) {
setIdeas((ideas) => ideas.filter((idea) => idea.$id !== id));
await init();
} catch (err) {
setError(err.message);
console.log(err)
}
}
@@ -99,7 +98,7 @@ export function IdeasProvider(props) {
);
setIdeas(response.documents);
} catch (err) {
setError(err.message);
console.log(err)
}
}