Commit 4ada796
authored
feat: integrate authentication on word editor page (#11)
This Pull Request integrates authentication on the word editor page at
`/editor`; this means a user is required to login via github oauth flow
in order to access this page. When a user tries to access this page and
they are not authenticated, they get redirected to the `/login` page
where they're requested to authorize via github oauth flow and back to
the `editor` after they complete authorization.
### Changes Made
- Integrated the `doAuth` action in the word editor page on the server
side.
```js
// src/pages/editor/index.astro
const { url: { pathname }, redirect } = Astro;
const { isAuthed, authedData: userData } = await doAuth(Astro);
if (!isAuthed) return redirect(`/login?redirect=${pathname}`);
$userData.set(userData);
```
- Fixed a tiny change in the `word-editor` for accessibility
### Screencast/Screenshot
[screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.03.30-19_18_45.webm](https://github.com/babblebey/jargons.dev/assets/25631971/b8775272-f343-4cde-857e-1a36635768ac)
📖1 parent dc2bb1a commit 4ada796
2 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
0 commit comments