Skip to content

Commit

Permalink
fix(vue): Fix bug in no-auth case
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Sep 6, 2024
1 parent 3bb3a0d commit 83d0d21
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
4 changes: 4 additions & 0 deletions packages/create-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ yarn
# start local development server
yarn dev
```

During local development, the application can be found at `https://127.0.0.1:4001`,
or another available port. Note that HTTPS is required when using OAuth, and the
URL (including port number) in your SPA OAuth Client configuration must match.
2 changes: 1 addition & 1 deletion packages/create-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "module",
"bin": "./scripts/create.js",
"scripts": {
"dev": "vite --host --port 4001",
"dev": "vite --host 127.0.0.1 --port 4001",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
Expand Down
4 changes: 4 additions & 0 deletions packages/create-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ yarn
# start local development server
yarn dev
```

During local development, the application can be found at `https://127.0.0.1:4002`,
or another available port. Note that HTTPS is required when using OAuth, and the
URL (including port number) in your SPA OAuth Client configuration must match.
2 changes: 1 addition & 1 deletion packages/create-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "module",
"bin": "./scripts/create.js",
"scripts": {
"dev": "vite --host --port 4002",
"dev": "vite --host 127.0.0.1 --port 4002",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/create-vue/src/components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import { routes, RoutePath, NAV_ROUTES } from '../routes';
>
</nav>
<span className="flex-space" />
<RouterLink :to="RoutePath.LOGOUT" class="body2 strong"
<RouterLink
v-if="context.oauth.enabled"
:to="RoutePath.LOGOUT"
class="body2 strong"
>Sign out</RouterLink
>
</header>
Expand Down
15 changes: 5 additions & 10 deletions packages/create-vue/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import { router } from './routes';
import { context } from './context';
import { createAuth0 } from '@auth0/auth0-vue';

const app = createApp(App);

app.use(router);

if (context.oauth.enabled) {
app.use(
createApp(App)
.use(router)
.use(
createAuth0({
domain: context.oauth.domain,
clientId: context.oauth.clientId!,
Expand All @@ -22,9 +19,7 @@ if (context.oauth.enabled) {
scope: context.oauth.scopes.join(' '),
},
}) as unknown as Plugin<[]>,
);
}

app.mount('#root');
)
.mount('#root');

document.title = context.title;

0 comments on commit 83d0d21

Please sign in to comment.