urls corrected on fetch
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
import type { FormSubmitEvent } from '@nuxt/ui'
|
import type { FormSubmitEvent } from '@nuxt/ui'
|
||||||
|
|
||||||
const { loggedIn } = useUserSession()
|
const { loggedIn } = useUserSession()
|
||||||
|
const conf = useRuntimeConfig()
|
||||||
|
const base_url = conf.app.baseURL.endsWith('/') ? conf.app.baseURL.slice(0, -1) : conf.app.baseURL
|
||||||
|
|
||||||
|
|
||||||
const video = ref(0);
|
const video = ref(0);
|
||||||
const url = ref("");
|
const url = ref("");
|
||||||
@@ -34,7 +37,7 @@
|
|||||||
|
|
||||||
|
|
||||||
async function start_conversion(event: FormSubmitEvent<musicParamsSchema>) {
|
async function start_conversion(event: FormSubmitEvent<musicParamsSchema>) {
|
||||||
return fetch("/convert", {
|
return fetch(base_url + "/convert", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import * as z from 'zod'
|
|||||||
import type { FormSubmitEvent, AuthFormField } from '@nuxt/ui'
|
import type { FormSubmitEvent, AuthFormField } from '@nuxt/ui'
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
const config = useRuntimeConfig()
|
||||||
|
|
||||||
|
const base_url = config.app.baseURL.endsWith('/') ? config.app.baseURL.slice(0, -1) : config.app.baseURL
|
||||||
|
|
||||||
const wrong_login = ref(false)
|
const wrong_login = ref(false)
|
||||||
|
|
||||||
@@ -36,8 +39,7 @@ const schema = z.object({
|
|||||||
type Schema = z.output<typeof schema>
|
type Schema = z.output<typeof schema>
|
||||||
|
|
||||||
function onSubmit(payload: FormSubmitEvent<Schema>) {
|
function onSubmit(payload: FormSubmitEvent<Schema>) {
|
||||||
console.log(payload.data)
|
return fetch(base_url + "/login", {
|
||||||
return fetch("/login", {
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type" : "application/json"
|
"Content-Type" : "application/json"
|
||||||
|
|||||||
@@ -7,10 +7,16 @@
|
|||||||
middleware: ["login-required"]
|
middleware: ["login-required"]
|
||||||
})
|
})
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
const conf = useRuntimeConfig()
|
||||||
const { data: user_data, refresh: userRefresh } = useFetch("/me");
|
const base_url = conf.app.baseURL.endsWith('/') ? conf.app.baseURL.slice(0, -1) : conf.app.baseURL
|
||||||
|
|
||||||
|
const { data: user_data, refresh: userRefresh } = useFetch(base_url + "/me");
|
||||||
const loading_btn = ref(false)
|
const loading_btn = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
first_name: z.string(),
|
first_name: z.string(),
|
||||||
last_name: z.string(),
|
last_name: z.string(),
|
||||||
@@ -21,7 +27,7 @@
|
|||||||
|
|
||||||
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
||||||
loading_btn.value = true
|
loading_btn.value = true
|
||||||
await fetch("/settings/edit_user", {
|
await fetch(base_url + "/settings/edit_user", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
})
|
})
|
||||||
const loading_btn = ref(false)
|
const loading_btn = ref(false)
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
const config = useRuntimeConfig()
|
||||||
|
const base_url = config.app.baseURL.endsWith('/') ? config.app.baseURL.slice(0, -1) : config.app.baseURL
|
||||||
|
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
old_pw: z.string(),
|
old_pw: z.string(),
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
||||||
loading_btn.value = true
|
loading_btn.value = true
|
||||||
try {
|
try {
|
||||||
fetch("/settings/changepw", {
|
fetch(base_url + "/settings/changepw", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
|
|||||||
Reference in New Issue
Block a user