API base now in config

This commit is contained in:
Jonathan Barrow 2022-10-01 13:00:05 -04:00
parent 11d2a073ea
commit ffec77b0ad
No known key found for this signature in database
GPG Key ID: E86E9FE9049C741F
2 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@
* browserify is needed for the use of require() in the browser
*/
const Mii = require('mii-js');
const config = require('../../../config.json');
const newMiiData = 'AwAAQOlVognnx0GC2qjhdwOzuI0n2QAAAGBzAHQAZQB2AGUAAAAAAAAAAAAAAEBAAAAhAQJoRBgmNEYUgRIXaA0AACkAUkhQAAAAAAAAAAAAAAAAAAAAAAAAAAAAANeC';
// Prevent the user from reloading or leaving the page
@ -476,7 +477,7 @@ document
const tokenType = document.cookie.split('; ').find(row => row.startsWith('token_type=')).split('=')[1];
const accessToken = document.cookie.split('; ').find(row => row.startsWith('access_token=')).split('=')[1];
fetch('https://api.pretendo.cc/v1/user', {
fetch(`${config.api_base}/v1/user`, {
method: 'POST',
headers: {
'Accept': 'application/json',

View File

@ -77,7 +77,7 @@ function parseDocs(rawDocs) {
}
function apiGetRequest(path, headers) {
return got.get(`https://api.pretendo.cc${path}`, {
return got.get(`${config.api_base}${path}`, {
responseType: 'json',
throwHttpErrors: false,
https: {
@ -88,7 +88,7 @@ function apiGetRequest(path, headers) {
}
function apiPostRequest(path, headers, json) {
return got.post(`https://api.pretendo.cc${path}`, {
return got.post(`${config.api_base}${path}`, {
responseType: 'json',
throwHttpErrors: false,
https: {
@ -100,7 +100,7 @@ function apiPostRequest(path, headers, json) {
}
function apiDeleteRequest(path, headers, json) {
return got.delete(`https://api.pretendo.cc${path}`, {
return got.delete(`${config.api_base}${path}`, {
throwHttpErrors: false,
https: {
rejectUnauthorized: false, // Needed for self-signed certificates on localhost testing