@ -598,10 +575,10 @@ other users' profiles by visiting `http://localhost:8080/other_user.id`
This sets up a route and captures the route path in the URL as the profile lookup username.
This sets up a route and captures the route path in the URL as the profile lookup username.
11. Save and close the the `src/components/App.jsx` file.
5. Save and close the the `src/components/App.js` file.
### Add a rule to process URL paths with . (dot)
### Add in lookupProfile
You also need to add a rule to your app's webpack config so that you can properly
You also need to add a rule to your app's webpack config so that you can properly
process URL paths that contain the `.` (dot) character for example,
process URL paths that contain the `.` (dot) character for example,
@ -610,28 +587,9 @@ process URL paths that contain the `.` (dot) character for example,
**NOTE**: In a production app, you must ensure the web server is configured to handle this.
**NOTE**: In a production app, you must ensure the web server is configured to handle this.
1. Open `webpack.config.js` in the root project directory and locate the following line:
1. Open the `src/components/Profile.js` file.
```javascript
historyApiFallback: true,
```
2. Replace it with this:
```javascript
historyApiFallback: {
disableDotRule: true
},
```
You will need to run `npm start` again for this change to take effect. Don't
worry, there is a later step for that to remind you.
3. Save and close the `webpack.config.js` file.
4. Open the `src/components/Profile.jsx` file.
5. Expand the `import from blockstack` statement to include the `lookupProfile` method.
2. Expand the `import from blockstack` statement to include the `lookupProfile` method.
Add `lookupProfile` after `Person`.
Add `lookupProfile` after `Person`.
@ -644,7 +602,7 @@ process URL paths that contain the `.` (dot) character for example,
} from 'blockstack';
} from 'blockstack';
```
```
6. Add a single method to the `Profile` class that determines if the app is viewing the local user's profile or another user's profile.
3. Add a single method to the `Profile` class that determines if the app is viewing the local user's profile or another user's profile.
```javascript
```javascript
isLocal() {
isLocal() {
@ -654,7 +612,7 @@ process URL paths that contain the `.` (dot) character for example,
You use `isLocal()` to check if the user is viewing the local user profile or another user's profile. If it's the local user profile, the app runs the `getFile()` function you added in an earlier step. Otherwise, the app looks up the profile belonging to the `username` using the `lookupProfile()` method.
You use `isLocal()` to check if the user is viewing the local user profile or another user's profile. If it's the local user profile, the app runs the `getFile()` function you added in an earlier step. Otherwise, the app looks up the profile belonging to the `username` using the `lookupProfile()` method.
7. Modify the `fetchData()` method like so:
4. Modify the `fetchData()` method like so:
```javascript
```javascript
fetchData() {
fetchData() {
@ -699,7 +657,7 @@ process URL paths that contain the `.` (dot) character for example,
documentation](http://blockstack.github.io/blockstack.js/#getfile) for
documentation](http://blockstack.github.io/blockstack.js/#getfile) for
details.
details.
8. Add the following block to `fetchData()` right after the call to `lookupProfile(username)... catch((error)=>{..}` block:
5. Add the following block to `fetchData()` right after the call to `lookupProfile(username)... catch((error)=>{..}` block:
@ -723,7 +681,7 @@ process URL paths that contain the `.` (dot) character for example,
Finally, you must conditionally render the logout button, status input textbox, and submit button so they don't show up when viewing another user's profile.
Finally, you must conditionally render the logout button, status input textbox, and submit button so they don't show up when viewing another user's profile.
9. Replace the `render()` method with the following:
6. Replace the `render()` method with the following:
```javascript
```javascript
render() {
render() {
@ -804,7 +762,7 @@ process URL paths that contain the `.` (dot) character for example,
npm start
npm start
```
```
3. Point your browser to `http://localhost:8080/your_username.id.blockstack` to see the final application.
3. Point your browser to `http://127.0.01:3000/your_username.id.blockstack` to see the final application.