Skip to content

Commit

Permalink
add broadcaster page
Browse files Browse the repository at this point in the history
  • Loading branch information
narkissbv committed May 22, 2022
1 parent ab0c51b commit c1742e3
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 11 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# twitch-vue-boilerplate
BoilerPlate for Vuejs extensions for Twitch
# twitch-queue-manager-vue

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
3 changes: 0 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
Expand Down
7 changes: 7 additions & 0 deletions src/broadcaster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createApp } from 'vue'
import BroadcasterPage from './views/BroadcasterPage'
import store from './store'

createApp(BroadcasterPage)
.use(store)
.mount('#app')
2 changes: 1 addition & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const store = createStore({
const userData = await axios.get(`https://api.twitch.tv/helix/users?id=${context.state.viewer.id}`, {
headers: {
'Authorization': `Extension ${context.state.auth.helixToken}`,
'Client-Id': '' // Your cliend ID goes here
'Client-Id': 'uo78wv9pfkz6j9xtorkwb291wd1rm6'
}
})
context.commit('setUsername', userData)
Expand Down
3 changes: 0 additions & 3 deletions src/views/AuthPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@

<style scoped>
.unauth {
display: flex;
padding: 10px;
text-align: center;
justify-content: center;
align-items: center;
}
.unauth p {
Expand Down
40 changes: 40 additions & 0 deletions src/views/BroadcasterPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<h2>Broadcaster page</h2>
<p>{{ username }}</p>
<p>{{ viewer }}</p>
</template>

<script setup>
import { useStore } from 'vuex'
import { computed, onMounted } from 'vue'
import twitch from '@/utils/twitch'
const store = useStore()
const username = computed(() => store.state.username);
const viewer = computed(() => store.state.viewer)
onMounted( () => {
twitch.onAuthorized(async function (auth) {
await store.dispatch('setAuth', auth);
await store.dispatch('setViewer');
if (viewer.value?.id) {
await store.dispatch('fetchUserData');
}
})
})
</script>
<style>
body {
background: #1f1f23;
color: white;
padding: 0;
margin: 0;
font-family: Inter,Roobert,Helvetica Neue,Helvetica,Arial,sans-serif;
height: 100vh;
position: relative;
overflow: hidden;
}
</style>
2 changes: 1 addition & 1 deletion src/views/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

<style scoped>
</style>
</style>
7 changes: 6 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
transpileDependencies: true,
publicPath: '',
pages: {
index: './src/main.js',
broadcaster: './src/broadcaster.js'
}
})

0 comments on commit c1742e3

Please sign in to comment.