feat(frontend): make api base configurable

This commit is contained in:
Tim
2025-07-04 18:29:01 +08:00
parent 8519a80485
commit a7c6be2735
3 changed files with 12 additions and 3 deletions

View File

@@ -48,6 +48,7 @@
</template>
<script>
import { API_BASE_URL } from '../main'
export default {
name: 'LoginPageView',
data() {
@@ -59,7 +60,7 @@ export default {
methods: {
async submitLogin() {
try {
const res = await fetch('/api/auth/login', {
const res = await fetch(`${API_BASE_URL}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: this.username, password: this.password })

View File

@@ -82,6 +82,7 @@
</template>
<script>
import { API_BASE_URL } from '../main'
export default {
name: 'SignupPageView',
@@ -98,7 +99,7 @@ export default {
methods: {
async sendVerification() {
try {
const res = await fetch('/api/auth/register', {
const res = await fetch(`${API_BASE_URL}/api/auth/register`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@@ -120,7 +121,7 @@ export default {
},
async verifyCode() {
try {
const res = await fetch('/api/auth/verify', {
const res = await fetch(`${API_BASE_URL}/api/auth/verify`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: this.username, code: this.code })