feat: add frontend
This commit is contained in:
22
frontend/src/services/http.js
Normal file
22
frontend/src/services/http.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import fixtures from '@/fixtures/index.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: '/api',
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
}
|
||||
});
|
||||
|
||||
const mock = async (fixture, process) => {
|
||||
let data = fixtures[fixture]
|
||||
if (typeof process === 'function') {
|
||||
data = process(data);
|
||||
}
|
||||
|
||||
console.log('mock', fixture, data);
|
||||
return data
|
||||
}
|
||||
|
||||
export { http, mock };
|
||||
|
||||
Reference in New Issue
Block a user