mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 16:38:20 +01:00
fix: 🐛 Fix pages using the wrong base URLs for API endpoints
This commit is contained in:
parent
7accd4c037
commit
65ad29ea92
|
|
@ -23,10 +23,8 @@ if (!config) {
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const url = process.client ? config.http.base_url : config.http.url;
|
|
||||||
|
|
||||||
const data = await fetch(
|
const data = await fetch(
|
||||||
new URL(`/api/v1/statuses/${route.params.uuid}`, url),
|
new URL(`/api/v1/statuses/${route.params.uuid}`, config.http.base_url),
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,9 @@ if (!config) {
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const url = process.client ? config.http.base_url : config.http.url;
|
|
||||||
|
|
||||||
const username = (route.params.username as string).replace("@", "");
|
const username = (route.params.username as string).replace("@", "");
|
||||||
|
|
||||||
const id = await fetch(new URL(`/api/v1/accounts/search?q=${username}`, url), {
|
const id = await fetch(new URL(`/api/v1/accounts/search?q=${username}`, config.http.base_url), {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
|
|
@ -38,7 +36,7 @@ const id = await fetch(new URL(`/api/v1/accounts/search?q=${username}`, url), {
|
||||||
let data = null;
|
let data = null;
|
||||||
|
|
||||||
if (id && id.length > 0) {
|
if (id && id.length > 0) {
|
||||||
data = await fetch(new URL(`/api/v1/accounts/${id[0].id}`, url), {
|
data = await fetch(new URL(`/api/v1/accounts/${id[0].id}`, config.http.base_url), {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { APIInstance } from "../../../../types/entities/instance";
|
|
||||||
import LoginInput from "../../components/LoginInput.vue";
|
import LoginInput from "../../components/LoginInput.vue";
|
||||||
|
|
||||||
const config = await useConfig();
|
const config = await useConfig();
|
||||||
|
|
@ -111,13 +110,9 @@ if (!config) {
|
||||||
throw new Error("Config not found");
|
throw new Error("Config not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = process.client ? config.http.base_url : config.http.url;
|
const instanceInfo = (await fetch(new URL("/api/v1/instance", config.http.base_url)).then(
|
||||||
|
|
||||||
const instanceInfo = (await fetch(new URL("/api/v1/instance", url)).then(
|
|
||||||
(data) => data.json(),
|
(data) => data.json(),
|
||||||
)) as APIInstance & {
|
));
|
||||||
tos_url: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const errors = ref<{
|
const errors = ref<{
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue