Skip to content

Commit 6c4611f

Browse files
author
Vianpyro
committed
Refactor authentication components to destructure apiBaseUrl from runtime config
1 parent d2c17ef commit 6c4611f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

components/authentication/Login.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import { ref } from 'vue';
1111
import { useRouter } from 'vue-router';
1212
import { useCookie } from '#app';
1313
14-
const config = useRuntimeConfig();
14+
const { public: { apiBaseUrl } } = useRuntimeConfig();
1515
const router = useRouter();
1616
1717
const email = ref('');
1818
const password = ref('');
1919
2020
const login = async () => {
2121
try {
22-
const data = await fetch(`${config.public.apiBaseUrl}/auth/login`, {
22+
const data = await fetch(`${apiBaseUrl}/auth/login`, {
2323
method: 'POST',
2424
headers: { 'Content-Type': 'application/json' },
2525
body: JSON.stringify({

components/authentication/Register.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { ref } from 'vue';
3131
import IconShow from '@/assets/icons/eye.svg';
3232
import IconHide from '@/assets/icons/eye-off.svg';
3333
34-
const config = useRuntimeConfig();
34+
const { public: { apiBaseUrl } } = useRuntimeConfig();
3535
3636
const username = ref('');
3737
const email = ref('');
@@ -55,7 +55,7 @@ const register = async () => {
5555
}
5656
5757
try {
58-
const response = await fetch(`${config.public.apiBaseUrl}/auth/register`, {
58+
const response = await fetch(`${apiBaseUrl}/auth/register`, {
5959
method: 'POST',
6060
headers: { 'Content-Type': 'application/json' },
6161
body: JSON.stringify({

0 commit comments

Comments
 (0)