mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-24 17:41:03 +01:00
added analytics for spider
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function login (username, password) {
|
||||
return request({
|
||||
url: '/user/login',
|
||||
method: 'post',
|
||||
data: {
|
||||
username,
|
||||
password
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getInfo (token) {
|
||||
return request({
|
||||
url: '/user/info',
|
||||
method: 'get',
|
||||
params: { token }
|
||||
})
|
||||
}
|
||||
|
||||
export function logout () {
|
||||
return request({
|
||||
url: '/user/logout',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import axios from 'axios'
|
||||
|
||||
let baseUrl = 'http://localhost:8000/api'
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
baseUrl = 'http://139.129.230.98:8000/api'
|
||||
}
|
||||
// const baseUrl = process.env.API_BASE_URL || 'http://localhost:8000/api'
|
||||
|
||||
const request = (method, path, params, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `${baseUrl}${path}`
|
||||
axios({
|
||||
method,
|
||||
url,
|
||||
params,
|
||||
data
|
||||
})
|
||||
.then(resolve)
|
||||
.catch(reject)
|
||||
})
|
||||
}
|
||||
|
||||
const get = (path, params) => {
|
||||
return request('GET', path, params)
|
||||
}
|
||||
|
||||
const post = (path, data) => {
|
||||
return request('POST', path, {}, data)
|
||||
}
|
||||
|
||||
const put = (path, data) => {
|
||||
return request('PUT', path, {}, data)
|
||||
}
|
||||
|
||||
const del = (path, data) => {
|
||||
return request('DELETE', path)
|
||||
}
|
||||
|
||||
export default {
|
||||
baseUrl,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
put,
|
||||
delete: del
|
||||
}
|
||||
@@ -4,6 +4,7 @@ let baseUrl = 'http://localhost:8000/api'
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
baseUrl = 'http://139.129.230.98:8000/api'
|
||||
}
|
||||
// console.log(process.env)
|
||||
// const baseUrl = process.env.API_BASE_URL || 'http://localhost:8000/api'
|
||||
|
||||
const request = (method, path, params, data) => {
|
||||
|
||||
Reference in New Issue
Block a user