based path correction
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
}).then(r => { // r resolves to { file: "my_audio.mp3" }
|
||||
const file = r.file; // in this case r["file"] --> "my_audio.mp3"
|
||||
const a = document.createElement("a");
|
||||
a.href = urlJoin(conf.app.baseURL, `/download/${file}`)
|
||||
a.href = useBasedPath(`/download/${file}`)
|
||||
a.download = file; // sets suggested filename
|
||||
file_dwnl.value = a.href; // this ref activates the Download button
|
||||
document.body.appendChild(a); // must append first
|
||||
@@ -62,7 +62,7 @@
|
||||
const res = r.data;
|
||||
console.log(r.data)
|
||||
if(res.statusCode == 401) {
|
||||
reloadNuxtApp({path: "/login"})
|
||||
navigateTo(useBasedPath("/login"),{external: true})
|
||||
}
|
||||
else toast.add({
|
||||
title: "Error",
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import * as z from 'zod'
|
||||
import type { FormSubmitEvent, AuthFormField } from '@nuxt/ui'
|
||||
import urlJoin from 'url-join'
|
||||
|
||||
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 fields: AuthFormField[] = [{
|
||||
@@ -47,7 +46,7 @@ function onSubmit(payload: FormSubmitEvent<Schema>) {
|
||||
remember: payload.data.remember || false
|
||||
}
|
||||
}).then((r) => {
|
||||
reloadNuxtApp({path: "/"});
|
||||
navigateTo(useBasedPath("/"), { external: true})
|
||||
}).catch((err) => {
|
||||
if(err.data.statusCode == 401) {
|
||||
wrong_login.value = true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import * as z from 'zod'
|
||||
import type { FormSubmitEvent } from '@nuxt/ui'
|
||||
import urlJoin from "url-join"
|
||||
import { use_based_path } from '~/composables/based_path'
|
||||
|
||||
definePageMeta({
|
||||
layout: "settings",
|
||||
@@ -28,7 +29,7 @@
|
||||
|
||||
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
||||
loading_btn.value = true
|
||||
await fetch(urlJoin(conf.app.baseURL, "/settings/edit_user"), {
|
||||
await fetch(use_based_path("/settings/edit_user"), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
@@ -66,7 +67,7 @@
|
||||
<div class="gap-3 justify-between">
|
||||
<div class="flex-1 w-full gap-2 mt-5 mb-5">
|
||||
<UFormField label="First Name" orientation="horizontal" name="first_name">
|
||||
<UInput v-if="user_data" v-model="user_data.first_name"/>
|
||||
<UInput v-if="user_data" v-model="user_data.first_name" required/>
|
||||
<USkeleton v-else class="w-53 h-7" />
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
definePageMeta({
|
||||
layout: "settings",
|
||||
middleware: ["login-required"]
|
||||
})
|
||||
const loading_btn = ref(false)
|
||||
const toast = useToast()
|
||||
@@ -35,7 +34,7 @@
|
||||
async function submitChanges(event: FormSubmitEvent<Schema>) {
|
||||
loading_btn.value = true
|
||||
try {
|
||||
fetch(urlJoin(config.app.baseURL,"/settings/changepw"), {
|
||||
fetch(useBasedPath("/settings/changepw"), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
|
||||
Reference in New Issue
Block a user