Skip to content

Commit

Permalink
[SolidJS-Tailwind] Implement authentication (#734)
Browse files Browse the repository at this point in the history
* chore(solidjs): remove example components

* feat(solidjs): add signin page

* refactor(solidjs): improve auth setup

* feat(solidjs): pencil in auth flow

* feat(solidjs): add example github communication

* [Angular - NgRx - SCSS] 440: state & service refactor (#527)

* setup: get branch caught up and ready for work

* feat: refactored repository service and test

* feat: refactor of user service and test

* feat: updated user service spec

* feat: created dashboard store files; updated global state files; renamed RepoState and updated all calls

* attempt to fix issues with service updates; some refactoring and adjusting so app compiles

* feat: added auth user data to auth state; updated nav component to use auth state

* feat: adjusted auth call; fixed user call so home page loads

* moved some user logic; still having reload issues and repo view issues

* feat: got app working again! cleaned out console logs

* rebased and fixed most files

* fix broken tests

* removed unused code

* fix: fix pr comments and most tests

* fix: fixed final broken unit test

* fix: updated test; removed unused code in user effect; new user mapping file

* add todo for refactor improvements; update authUser effect to use different rxjs operation

Co-authored-by: LindaT <[email protected]>

* feat(solidjs) - Create navigation header (#840)

* fix(angular-apollo-tailwind): append protocol if missing from user url (#637)

* fix(angular-apollo-tailwind): append protocol if missing from user url

Refs: #591

* test(angular-apollo-tailwind): update with testcases

Closes: #591

* chore: repo card with story and test (#737)

* chore: repo card with story and test

* fix comments

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore: gist panel UI (#741)

* chore: gist panel UI

* fix coment

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore(solidjs): remove example components

* fixed comments, clean ups

Co-authored-by: Linda Thompson <[email protected]>
Co-authored-by: LindaT <[email protected]>
Co-authored-by: Daian Scuarissi <[email protected]>
Co-authored-by: Oluwakorede Cole <[email protected]>
Co-authored-by: Jerry Hogan <[email protected]>
Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>
  • Loading branch information
7 people authored Nov 17, 2022
1 parent a9d93e6 commit 6f21c5c
Show file tree
Hide file tree
Showing 31 changed files with 349 additions and 253 deletions.
3 changes: 3 additions & 0 deletions solidjs-tailwind/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_API_URL=https://api.starter.dev/api
VITE_GITHUB_URL=https://api.github.com
VITE_BASE_URL=http://localhost:3000
5 changes: 5 additions & 0 deletions solidjs-tailwind/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
node_modules
dist

# env file
.env.development
.env.production
.env.local

# .vscode
.vscode/*
24 changes: 12 additions & 12 deletions solidjs-tailwind/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
<title>solidjs-tailwindcss starter kit</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000000"/>
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico"/>
<title>solidjs-tailwindcss starter kit</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<script src="/src/index.jsx" type="module"></script>
</body>
<script src="/src/index.jsx" type="module"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions solidjs-tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
"@heroicons/react": "1.0.5"
},
"dependencies": {
"@octokit/rest": "^19.0.5",
"isomorphic-fetch": "^3.0.0",
"solid-heroicons": "^3.1.0",
"solid-js": "1.6.0"
},
Expand Down
167 changes: 161 additions & 6 deletions solidjs-tailwind/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 8 additions & 13 deletions solidjs-tailwind/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { Routes, Route } from '@solidjs/router';
import { Header} from './components/';
import { Home, Counter, ApiExample } from './pages';
import { Route, Routes } from '@solidjs/router';
import { Home, RedirectPage, SigninPage } from './pages';
import ROUTES from './routes';

function App() {
return (
<>
<Header user={{login: 'SDaian'}}/>
<div class="text-center">
<Routes>
<Route component={Home} path="/" />
<Route component={Counter} path="/counter" />
<Route component={ApiExample} path="/api-example" />
</Routes>
</div>
</>
<Routes>
<Route component={Home} path={ROUTES.HOME} />
<Route component={SigninPage} path={ROUTES.SIGNIN} />
<Route component={RedirectPage} path={ROUTES.REDIRECT} />
</Routes>
);
}

Expand Down
11 changes: 11 additions & 0 deletions solidjs-tailwind/src/auth/AuthStore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createStore } from 'solid-js/store';

const createAuthStore = () =>
createStore({
token: null,
get isAuthenticated() {
return !!this.token;
},
});

export default createAuthStore;
11 changes: 11 additions & 0 deletions solidjs-tailwind/src/auth/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import createAuthStore from './AuthStore';
import ROUTES from '../routes';
import createPreventUnauthorised from './preventUnauthorised';

const [authStore, setAuth] = createAuthStore();
const preventUnauthorised = createPreventUnauthorised(authStore, ROUTES.SIGNIN);
export const useAuth = () => ({
authStore,
preventUnauthorised,
setAuth,
});
Loading

0 comments on commit 6f21c5c

Please sign in to comment.