Skip to content

Commit 6062555

Browse files
committed
Merge remote-tracking branch 'origin/source' into source
2 parents 84ec865 + d56d760 commit 6062555

File tree

15 files changed

+40
-39
lines changed

15 files changed

+40
-39
lines changed

src/content/1/en/part1b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ If and <i>when</i> you encounter an error message
263263

264264
> <i>Objects are not valid as a React child</i>
265265
266-
keep in mind the things told [here](/en/part1/introduction_to_react#do-not-rended-object).
266+
keep in mind the things told [here](/en/part1/introduction_to_react#do-not-render-object).
267267

268268
<h4>1.3: course information step3</h4>
269269

src/content/1/en/part1d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ If and <i>when</i> you encounter an error message
10581058

10591059
> <i>Objects are not valid as a React child</i>
10601060
1061-
keep in mind the things told [here](/en/part1/introduction_to_react#do-not-rended-object).
1061+
keep in mind the things told [here](/en/part1/introduction_to_react#do-not-render-object).
10621062

10631063
<h4> 1.6: unicafe step1</h4>
10641064

src/content/6/en/part6d.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ Most React applications need not only a way to temporarily store the served data
349349

350350
<div class="tasks">
351351

352-
### Exercises 6.19.-6.21.
352+
### Exercises 6.20.-6.22.
353353

354354
Now let's make a new version of the anecdote application that uses the React Query library. Take [this project](https://github.com/fullstack-hy2020/query-anecdotes) as your starting point. The project has a ready-installed JSON Server, the operation of which has been slightly modified. Start the server with <i>npm run server</i>.
355355

356-
#### Exercise 6.19
356+
#### Exercise 6.20
357357

358358
Implement retrieving anecdotes from the server using React Query.
359359

@@ -386,11 +386,11 @@ const result = useQuery(
386386
)
387387
```
388388

389-
#### Exercise 6.20
389+
#### Exercise 6.21
390390

391391
Implement adding new anecdotes to the server using React Query. The application should render a new anecdote by default. Note that the content of the anecdote must be at least 5 characters long, otherwise the server will reject the POST request. You don't have to worry about error handling now.
392392

393-
#### Exercise 6.21
393+
#### Exercise 6.22
394394

395395
Implement voting for anecdotes using again the React Query. The application should automatically render the increased number of votes for the voted anecdote
396396

@@ -759,9 +759,9 @@ As a technical detail, it should be noted that the helper functions <i>useCounte
759759

760760
<div class="tasks">
761761

762-
### Exercises 6.22.-6.23.
762+
### Exercises 6.23.-6.24.
763763

764-
#### Exercise 6.22.
764+
#### Exercise 6.23.
765765

766766
The application has a <i>Notification</i> component for displaying notifications to the user.
767767

@@ -771,7 +771,7 @@ Implement the application's notification state management using the useReducer h
771771

772772
The notification is displayed for five seconds.
773773

774-
#### Exercise 6.23.
774+
#### Exercise 6.24.
775775

776776
As stated in exercise 6.20, the server requires that the content of the anecdote to be added is at least 5 characters long. Now implement error handling for the insertion. In practice, it is sufficient to display a notification to the user in case of a failed POST request:
777777

src/content/6/fi/osa6d.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,12 @@ React Query on siis kirjasto, joka ylläpitää frontendissä <i>palvelimen tila
345345

346346
<div class="tasks">
347347

348-
### Tehtävät 6.19.-6.21.
348+
### Tehtävät 6.20.-6.22.
349349

350350
Tehdään nyt anekdoottisovelluksesta uusi, React Query -kirjastoa hyödyntävä versio. Ota lähtökohdaksesi
351351
[täällä](https://github.com/fullstack-hy2020/query-anecdotes) oleva projekti. Projektissa on valmiina asennettuna JSON Server, jonka toimintaa on hieman modifioitu. Käynnistä palvelin komennolla <i>npm run server</i>.
352352

353-
#### Tehtävä 6.19
353+
#### Tehtävä 6.20
354354

355355
Toteuta anekdoottien hakeminen palvelimelta React Queryn avulla.
356356

@@ -382,11 +382,11 @@ const result = useQuery(
382382
)
383383
```
384384

385-
#### Tehtävä 6.20
385+
#### Tehtävä 6.21
386386

387387
Toteuta uusien anekdoottien lisääminen palvelimelle React Queryn avulla. Sovelluksen tulee automaattisesti renderöidä lisätty anekdootti. Huomaa, että anekdootin sisällön pitää olla vähintään 5 merkkiä pitkä, muuten palvelin ei hyväksy POST pyyntöä. Virheiden käsittelystä ei tarvitse nyt välittää.
388388

389-
#### Tehtävä 6.21
389+
#### Tehtävä 6.22
390390

391391
Toteuta anekdoottien äänestäminen hyödyntäen jälleen React Queryä. Sovelluksen tulee automaattisesti renderöidä äänestetyn anekdootin kasvatettu äänimäärä.
392392

@@ -759,9 +759,9 @@ Teknisenä yksityiskohtana todettakoon, että apufunktiot <i>useCounterValue</i>
759759

760760
<div class="tasks">
761761

762-
### Tehtävät 6.22.-6.23.
762+
### Tehtävät 6.23.-6.24.
763763

764-
#### Tehtävä 6.22.
764+
#### Tehtävä 6.23.
765765

766766
Sovelluksessa on valmiina komponentti <i>Notification</i> käyttäjälle tehtävien notifikaatioiden näyttämistä varten.
767767

@@ -771,7 +771,7 @@ Toteuta sovelluksen notifikaation tilan hallinta useReduce-hookin ja contextin a
771771

772772
Notifikaatio näytetään viiden sekunnin ajan.
773773

774-
#### Tehtävä 6.23.
774+
#### Tehtävä 6.24.
775775

776776
Kuten tehtävässä 6.20 todettiin, palvelin vaatii, että lisättävän anekdootin sisällön pituus on vähintään 5 merkkiä. Toteuta nyt lisäämisen yhteyteen virheenkäsittely. Käytännössä riittää, että näytät epäonnistuneen lisäyksen yhteydessä käyttäjälle notifikaation:
777777

src/content/8/en/part8a.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -925,11 +925,8 @@ In some cases, it might be beneficial to name the queries. This is the case espe
925925
Through the exercises, we will implement a GraphQL backend for a small library.
926926
Start with [this file](https://github.com/fullstack-hy2020/misc/blob/master/library-backend.js). Remember to _npm init_ and to install dependencies!
927927

928-
Note also that the code does not initially work since the schema definition is not complete.
929-
930928
#### 8.1: The number of books and authors
931929

932-
933930
Implement queries _bookCount_ and _authorCount_ which return the number of books and the number of authors.
934931

935932
The query

src/content/8/en/part8b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ Through these exercises, we'll implement a frontend for the GraphQL library.
835835
836836
Take [this project](https://github.com/fullstack-hy2020/library-frontend) as a start for your application.
837837
838-
You can implement your application either using the render prop components <i>Query</i> and <i>Mutation</i> of the Apollo Client, or using the hooks provided by Apollo client 3.0.
838+
**Note** if you want, you can also use [React router](/en/part7/react_router) to implement the application's navigation!
839839
840840
#### 8.8: Authors view
841841

src/content/8/en/part8c.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const mongoose = require('mongoose')
6060
mongoose.set('strictQuery', false)
6161
const Person = require('./models/person')
6262

63+
require('dotenv').config()
64+
6365
const MONGODB_URI = process.env.MONGODB_URI
6466

6567
console.log('connecting to', MONGODB_URI)
@@ -549,11 +551,11 @@ type Mutation {
549551
550552
Complete the program so that all queries (to get _allBooks_ working with the parameter _author_ and _bookCount_ field of an author object is not required) and mutations work.
551553
552-
You might find [this](https://docs.mongodb.com/manual/reference/operator/query/in/) useful.
554+
Regarding the <i>genre</i> parameter of the all books query, the situation is a bit more challenging. The solution is simple, but finding it can be a headache. You might benefit from [this](https://www.mongodb.com/docs/manual/tutorial/query-array-of-documents/).
553555
554556
#### 8.15 Database, part 3
555557
556-
Complete the program so that database validation errors (e.g. book title or author name being too short) are handled sensibly. This means that they cause _UserInputError_ with a suitable error message to be thrown.
558+
Complete the program so that database validation errors (e.g. book title or author name being too short) are handled sensibly. This means that they cause [GraphQLError](https://www.apollographql.com/docs/apollo-server/data/errors/#custom-errors) with a suitable error message to be thrown.
557559
558560
#### 8.16 user and logging in
559561

src/content/8/en/part8d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const authLink = setContext((_, { headers }) => {
180180
// highlight-end
181181

182182
const httpLink = createHttpLink({
183-
uri: '/graphql',
183+
uri: 'http://localhost:4000',
184184
})
185185

186186
const client = new ApolloClient({

src/content/8/en/part8e.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ const start = async () => {
488488

489489
// highlight-start
490490
const schema = makeExecutableSchema({ typeDefs, resolvers })
491-
const serverCleanup = useServer({ schema }, wsServer);
491+
const serverCleanup = useServer({ schema }, wsServer)
492492
// highlight-end
493493

494494
const server = new ApolloServer({
@@ -668,7 +668,7 @@ const authLink = setContext((_, { headers }) => {
668668
return {
669669
headers: {
670670
...headers,
671-
authorization: token ? `bearer ${token}` : null,
671+
authorization: token ? `Bearer ${token}` : null,
672672
}
673673
}
674674
})
@@ -707,10 +707,10 @@ ReactDOM.createRoot(document.getElementById('root')).render(
707707
)
708708
```
709709

710-
For this to work, we have to install some dependencies:
710+
For this to work, we have to install a dependency:
711711

712712
```bash
713-
npm install @apollo/client graphql-ws
713+
npm install graphql-ws
714714
```
715715

716716
The new configuration is due to the fact that the application must have an HTTP connection as well as a WebSocket connection to the GraphQL server.
@@ -1100,7 +1100,7 @@ Start using subscriptions in the client, and subscribe to _bookAdded_. When new
11001100

11011101
#### 8.25: Subscriptions - client, part 2
11021102

1103-
Keep the application's view updated when the server notifies about new books. You can test your implementation by opening the app in two browser tabs and adding a new book in one tab. Adding the new book should update the view in both tabs.
1103+
Keep the application's book view updated when the server notifies about new books (you can ignore the author view!). You can test your implementation by opening the app in two browser tabs and adding a new book in one tab. Adding the new book should update the view in both tabs.
11041104

11051105
#### 8.26: n+1
11061106

src/content/8/fi/osa8a.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,6 @@ Joissain tilanteissa voi myös olla hyötyä nimetä kyselyt. Näin on erityises
923923

924924
Tehtävissä toteutetaan yksinkertaisen kirjaston GraphQL:ää tarjoava backend. Ota sovelluksesi lähtökohdaksi [tämä tiedosto](https://github.com/fullstack-hy2020/misc/blob/master/library-backend.js). Muista _npm init_ ja riippuvuuksien asentaminen!
925925

926-
Huomaa, että koodin käynnistäminen aiheuttaa alussa virheen, sillä skeeman määrittely on puutteellinen.
927-
928926
#### 8.1: kirjojen ja kirjailijoiden määrä
929927

930928
Toteuta kyselyt _bookCount_ ja _authorCount_ jotka palauttavat kirjojen ja kirjailijoiden lukumäärän.

0 commit comments

Comments
 (0)