refactor/issue-1/first-setup #9

Merged
fbenoist68 merged 16 commits from refactor/issue-1/first-setup into dev 2024-01-02 21:20:30 +01:00
3 changed files with 3 additions and 3 deletions
Showing only changes of commit c3f497b4d2 - Show all commits

View File

@ -2,7 +2,7 @@ import { createFetch } from '@vueuse/core'
import { destr } from 'destr' import { destr } from 'destr'
export const useApi = createFetch({ export const useApi = createFetch({
baseUrl: import.meta.env.VITE_API_BASE_URL || '/api', baseUrl: import.meta.env.VITE_API_BASE_URL,
fetchOptions: { fetchOptions: {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',

View File

@ -11,7 +11,7 @@ export const userStore = defineStore('user', {
actions: { actions: {
async login(username: string, password: string, ability: any) { async login(username: string, password: string, ability: any) {
try { try {
const res = await $api('http://localhost:8080/hdpos/api/auth/login', { const res = await $api(`${import.meta.env.VITE_API_BASE_URL}/auth/login`, {
method: 'POST', method: 'POST',
body: { body: {
username, username,

View File

@ -1,7 +1,7 @@
import { ofetch } from 'ofetch' import { ofetch } from 'ofetch'
export const $api = ofetch.create({ export const $api = ofetch.create({
baseURL: import.meta.env.VITE_API_BASE_URL || '/api', baseURL: import.meta.env.VITE_API_BASE_URL,
async onRequest({ options }) { async onRequest({ options }) {
const accessToken = useCookie('accessToken').value const accessToken = useCookie('accessToken').value
if (accessToken) { if (accessToken) {