Moved axios api call to seasonedAPI controller
This commit is contained in:
@@ -42,11 +42,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
|
||||||
import storage from '../storage.js'
|
import storage from '../storage.js'
|
||||||
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
||||||
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
|
|
||||||
|
import { plexAuthenticate } from '@/seasonedAPI.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { SeasonedInput, SeasonedButton },
|
components: { SeasonedInput, SeasonedButton },
|
||||||
data(){
|
data(){
|
||||||
@@ -69,20 +70,8 @@ export default {
|
|||||||
authenticatePlex() {
|
authenticatePlex() {
|
||||||
let username = this.plexUsername
|
let username = this.plexUsername
|
||||||
let password = this.plexPassword
|
let password = this.plexPassword
|
||||||
console.log(username, password)
|
|
||||||
|
|
||||||
axios({
|
plexAuthenticate(username, password)
|
||||||
method: 'POST',
|
|
||||||
url: `https://plex.tv/users/sign_in.json?user[login]=${username}&user[password]=${password}`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Plex-Platform': 'Linux',
|
|
||||||
'X-Plex-Version': 'v2.0.24',
|
|
||||||
'X-Plex-Platform-Version': '4.13.0-36-generic',
|
|
||||||
'X-Plex-Device-Name': 'Tautulli',
|
|
||||||
'X-Plex-Client-Identifier': '123'
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
let data = resp.data;
|
let data = resp.data;
|
||||||
console.log('response from plex:', data.user)
|
console.log('response from plex:', data.user)
|
||||||
@@ -90,7 +79,6 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log('error: ', error)
|
console.log('error: ', error)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
document.title = 'Settings' + storage.pageTitlePostfix;
|
document.title = 'Settings' + storage.pageTitlePostfix;
|
||||||
|
|||||||
Reference in New Issue
Block a user