This commit is contained in:
parent
3a09aaa751
commit
4f87bcecf8
6
src/api/encode.js
Normal file
6
src/api/encode.js
Normal file
@ -0,0 +1,6 @@
|
||||
export const encodeURL = (url)=>{
|
||||
if (url.indexOf('%') !== -1) {
|
||||
return url
|
||||
}
|
||||
return encodeURIComponent(url)
|
||||
}
|
@ -13,5 +13,5 @@ export const UpdateProduct=(p)=>{
|
||||
}
|
||||
|
||||
export const GetProduct = (pid) => {
|
||||
return product.get(`p/${encodeURIComponent(pid)}`)
|
||||
return product.get(`p/${encodeURL(pid)}`)
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import {mande} from "mande";
|
||||
import {queryRemoveZero} from "@/api/utils.js";
|
||||
import {encodeURL} from "@/api/encode.js";
|
||||
|
||||
const providers = mande('/api/v2/providers')
|
||||
|
||||
@ -47,13 +48,13 @@ export const FetchProviderArticlePrice = (providerArticle)=>{
|
||||
}
|
||||
|
||||
export const FetchProviderArticleAts = (providerArticle)=>{
|
||||
return provider.post(`/${providerArticle.providerId}/ats/fetch/${encodeURIComponent(providerArticle.skuID)}`)
|
||||
return provider.post(`/${providerArticle.providerId}/ats/fetch/${encodeURL(providerArticle.skuID)}`)
|
||||
}
|
||||
|
||||
export const GetProviderArticleAts = (providerId, pid)=>{
|
||||
return provider.get(`/${providerId}/ats/${encodeURIComponent(pid)}`)
|
||||
return provider.get(`/${providerId}/ats/${encodeURL(pid)}`)
|
||||
}
|
||||
|
||||
export const FetchProviderArticleDetail = (providerId, pid)=>{
|
||||
return provider.post(`/${providerId}/detail/fetch/${encodeURIComponent(pid)}`)
|
||||
return provider.post(`/${providerId}/detail/fetch/${encodeURL(pid)}`)
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {mande} from "mande";
|
||||
import {provider} from "@/api/provider.js";
|
||||
import {queryRemoveZero} from "@/api/utils.js";
|
||||
import {encodeURL} from "@/api/encode.js";
|
||||
|
||||
const tracers = mande('/api/v2/tracers')
|
||||
|
||||
@ -10,13 +11,13 @@ export const ListTracers = (q) => {
|
||||
}
|
||||
|
||||
export const CreateTracer = (providerId, skuID)=>{
|
||||
return provider.post(`${providerId}/ats-trace/${encodeURIComponent(skuID)}`)
|
||||
return provider.post(`${providerId}/ats-trace/${encodeURL(skuID)}`)
|
||||
}
|
||||
|
||||
export const DeleteTracer = (providerId, skuID)=>{
|
||||
return provider.delete(`${providerId}/ats-trace/${encodeURIComponent(skuID)}`)
|
||||
return provider.delete(`${providerId}/ats-trace/${encodeURL(skuID)}`)
|
||||
}
|
||||
|
||||
export const StopTracer = (providerId,skuID)=>{
|
||||
return provider.post(`${providerId}/ats-trace/stop/${encodeURIComponent(skuID)}`)
|
||||
return provider.post(`${providerId}/ats-trace/stop/${encodeURL(skuID)}`)
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import {mande} from "mande";
|
||||
import {provider} from "@/api/provider.js";
|
||||
import {queryRemoveZero} from "@/api/utils.js";
|
||||
import {encodeURL} from "@/api/encode.js";
|
||||
|
||||
const watchers = mande('/api/v2/watchers')
|
||||
|
||||
@ -10,13 +11,13 @@ export const ListWatchers = (q) => {
|
||||
}
|
||||
|
||||
export const CreateWatcher = (providerId, skuID)=>{
|
||||
return provider.post(`${providerId}/watch/${encodeURIComponent(skuID)}`)
|
||||
return provider.post(`${providerId}/watch/${encodeURL(skuID)}`)
|
||||
}
|
||||
|
||||
export const DeleteWatcher = (providerId, skuID)=>{
|
||||
return provider.delete(`${providerId}/watch/${encodeURIComponent(skuID)}`)
|
||||
return provider.delete(`${providerId}/watch/${encodeURL(skuID)}`)
|
||||
}
|
||||
|
||||
export const StopWatcher = (providerId,skuID)=>{
|
||||
return provider.post(`${providerId}/watch/stop/${encodeURIComponent(skuID)}`)
|
||||
return provider.post(`${providerId}/watch/stop/${encodeURL(skuID)}`)
|
||||
}
|
Loading…
Reference in New Issue
Block a user