Use base URL for axios (#241)

* Switch site to use axios base url

* Fix team invites

* Fix find/replace setting the wrong thing

* Fix analytics being blocking, small issues
This commit is contained in:
Geometrically
2021-05-28 10:19:13 -07:00
committed by GitHub
parent 03cbab5267
commit 5017c5a5f1
25 changed files with 137 additions and 209 deletions

View File

@@ -102,8 +102,6 @@
</div>
</template>
<script>
import axios from 'axios'
import Multiselect from 'vue-multiselect'
export default {
@@ -144,7 +142,7 @@ export default {
if (!this.version.changelog && this.version.changelog_url) {
this.version.changelog = (
await axios.get(this.version.changelog_url)
await this.$axios.get(this.version.changelog_url)
).data
}
},
@@ -152,8 +150,8 @@ export default {
try {
const [selectableLoaders, selectableVersions] = (
await Promise.all([
axios.get(`https://api.modrinth.com/api/v1/tag/loader`),
axios.get(`https://api.modrinth.com/api/v1/tag/game_version`),
data.$axios.get(`tag/loader`),
data.$axios.get(`tag/game_version`),
])
).map((it) => it.data)
@@ -185,8 +183,8 @@ export default {
this.$nuxt.$loading.start()
try {
await axios.patch(
`https://api.modrinth.com/api/v1/version/${this.version.id}`,
await this.$axios.patch(
`version/${this.version.id}`,
this.version,
this.$auth.headers
)

View File

@@ -136,8 +136,6 @@
</div>
</template>
<script>
import axios from 'axios'
import ConfirmPopup from '~/components/ui/ConfirmPopup'
import Categories from '~/components/ui/search/Categories'
@@ -201,11 +199,9 @@ export default {
if (!this.version.changelog && this.version.changelog_url) {
this.version.changelog = (
await axios.get(this.version.changelog_url)
await this.$axios.get(this.version.changelog_url)
).data
}
console.log(this.version)
},
data() {
return {
@@ -229,10 +225,7 @@ export default {
async deleteFile(hash) {
this.$nuxt.$loading.start()
await axios.delete(
`https://api.modrinth.com/api/v1/version_file/${hash}`,
this.$auth.headers
)
await this.$axios.delete(`version_file/${hash}`, this.$auth.headers)
await this.$router.go(null)
this.$nuxt.$loading.finish()
@@ -240,8 +233,8 @@ export default {
async makePrimary(hash) {
this.$nuxt.$loading.start()
await axios.patch(
`https://api.modrinth.com/api/v1/version/${this.version.id}`,
await this.$axios.patch(
`version/${this.version.id}`,
{
primary_file: ['sha1', hash],
},
@@ -273,8 +266,8 @@ export default {
}
try {
await axios({
url: `https://api.modrinth.com/api/v1/version/${this.version.id}/file`,
await this.$axios({
url: `version/${this.version.id}/file`,
method: 'POST',
data: formData,
headers: {
@@ -302,10 +295,7 @@ export default {
async deleteVersion() {
this.$nuxt.$loading.start()
await axios.delete(
`https://api.modrinth.com/api/v1/version/${this.version.id}`,
this.$auth.headers
)
await this.$axios.delete(`version/${this.version.id}`, this.$auth.headers)
await this.$router.replace(`/mod/${this.mod.id}`)
this.$nuxt.$loading.finish()