Add Auth0

This commit is contained in:
2022-04-09 02:02:30 -05:00
parent 902e51f099
commit 17dedd2d37
7 changed files with 112 additions and 68 deletions

View File

@@ -1,20 +1,10 @@
<script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import HelloWorld from './components/HelloWorld.vue'
import Home from './components/Home.vue'
</script>
<template>
<div id = "sidebar">
</div>
<div id = "main">
<img alt="Vue logo" src="./assets/logo.png" />
<git msg="Hello Vue 3 + TypeScript + Vite" />
</div>
<img alt="Vue logo" src="./assets/logo.png" />
<Home msg="CrystalMathy" />
</template>
<style>

View File

@@ -1,52 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<p>
Recommended IDE setup:
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
</p>
<p>See <code>README.md</code> for more information.</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Docs
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
</p>
<button type="button" @click="count++">count is: {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>
<style scoped>
a {
color: #42b983;
}
label {
margin: 0 0.5em;
font-weight: bold;
}
code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px;
color: #304455;
}
</style>

33
src/components/Home.vue Normal file
View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useAuth0 } from '@auth0/auth0-vue';
defineProps<{ msg: string }>()
const { loginWithRedirect } = useAuth0();
const login = () => {
loginWithRedirect();
}
</script>
<template>
<h1>{{ msg }}</h1>
<button @click="login">Log in</button>
</template>
<style scoped>
button {
background-color: #215b8a; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 32px;
border-radius: 5px;
}
</style>

View File

@@ -1,9 +1,18 @@
import { createApp } from 'vue'
import App from './App.vue'
import Draggable, { DraggablePlugin, DraggableDirective } from '@braks/revue-draggable'
import { DraggablePlugin } from '@braks/revue-draggable'
import { createAuth0 } from '@auth0/auth0-vue'
const app = createApp(App)
app.use(
createAuth0({
domain: 'dev-ge84r-eu.us.auth0.com',
client_id: 'zHjZGg1uPws0DkQg5bRdKcDX8m6AuTZl', // eslint-disable-line camelcase
redirect_uri: window.location.origin, // eslint-disable-line camelcase
}),
)
app.use(DraggablePlugin)
app.mount('#app')