-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat nuxt tutorial #355
Feat nuxt tutorial #355
Conversation
Your Render PR Server URL is https://appwrite-pr-355.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-clbsi8l4lnec73ecovug. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
<!-- Email and logout button if logged in user --> | ||
<div | ||
class="main-header-end u-margin-inline-end-16" | ||
v-if="user.isLoggedIn.value === true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC you don't need .value in templates. Weird, I know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
import { database } from "~/appwrite"; | ||
import { ref } from "vue"; | ||
|
||
const ideasDatabaseId = import.meta.env.VITE_IDEAS_DATABASE_ID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ideas prefix is unnecessary, we can infer it's the ideas database from the file name, or by the env variable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
// Fetch the 10 most recent ideas from the database | ||
// Add the list to the current reference object | ||
const init = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is misleading, since this is used more than once. Refetch or invalidate would be better names. Also, this can be called immediately when the composable is created, and probably doesn't need to be an exposed method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
<input | ||
type="text" | ||
placeholder="Title" | ||
v-model="addIdeaData.title.value" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formdata could be used to avoid creating refs and binding them. Especially as nothing else is being done with these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Next, add the component to the page `pages/index.vue` by auto-importing it in the `<template>`tag. | ||
In doing that, we need to take a moment to think about how we want to display the form to the users. | ||
Since it should only be shown to logged in user, we need to wrap it in a `<section>`that renders conditionally when the `isLoggedIn` reference in the `useUserSession` is true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some spaces are missing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Your Render PR Server URL is https://appwrite-io-pr-355.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cmfhop7109ks73ejn4pg. |
|
||
<template> | ||
<div> | ||
<h1>Hello, idea tracker!</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add pink classes to make it look pwetty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
await account.deleteSession("current"); // Delete Appwrite user session | ||
current.value = null; // Clear current ref | ||
navigateTo("/"); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to check if the user is logged in when initialising the composable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
const ideas = useIdeas(); | ||
const user = useUserSession(); | ||
|
||
console.log(ideas.current.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
onMounted(() => { | ||
ideas.fetch(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done inside useIdeas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
<!-- Section with form component for logged in users --> | ||
<!-- Section with paragraph for not logged in users --> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with ...skipped code.
--- | ||
|
||
# Test your project {% #test-project %} | ||
Run your project with `npm run dev -- --open --port 3000` and open [http://localhost:3000](http://localhost:3000) in your browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another one of the steps, we mentioned using npm run dev
directly, instead of specifying a port.
IMO, we should not try and change the port, no reason to. Port 3000 is a React convention, most projects use something else, and it's fine :)
Your Render PR Server URL is https://appwrite-io-docker-pr-355.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cmgpad021fec738lsoj0. |
feat: android tutorial
@gewenyu99 why does this have an android tutorial in it as well? |
I merged the Android tutorial reviewed separately here. There are some shared photo assets. |
|
||
Next, head over to the `pages`directory. | ||
This is where we will keep the content that will render on our pages in the web application. | ||
Each file you put in here will automatically become a route. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be unclear as to what that means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The response from these interactions will be stored as references to get more information about the user in our app. | ||
|
||
In your `composable` directory, create the file `useUserSession.js` and add the following code. | ||
Then you can call the `useUserSession()` function in the pages and components to use the functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include this line after the code snippet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
}); | ||
|
||
return { | ||
current, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current is a weird name, maybe call it user
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's fine, since you're doing user.current.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's the idea
In step 5 we will add a login button that will redirect us to this page. | ||
|
||
We will define functions to handle form submissions and show either a signup | ||
or a login form, which renders one form or the other depending on `isSignUp`'s state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSignUp
has not yet been defined, isn't it confusing?
# Authentication forms {% #auth-forms %} | ||
|
||
In the previous step, we defined a `AuthForm` to handle signup and login. | ||
Let's build this form now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, shouldn't we maybe create it before the page? Either is fine by me, just a suggestion.
|
||
<template> | ||
<div class="u-max-width-650" style="margin: 0 auto;"> | ||
... Some skipped code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use HTML commments
</div> | ||
</template> | ||
|
||
.. Skipped script section and styling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Co-authored-by: Thomas G. Lopes <26071571+TGlide@users.noreply.github.com>
Co-authored-by: Thomas G. Lopes <26071571+TGlide@users.noreply.github.com>
Co-authored-by: Thomas G. Lopes <26071571+TGlide@users.noreply.github.com>
What does this PR do?
Add Nuxt tutorial by @evelinabe
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)