1
1
import { MatchResult } from "path-to-regexp" ;
2
2
import { apiker } from "../Apiker" ;
3
3
import { getClientId , getRawIp , getSignedIp } from "../Auth" ;
4
- import { OBMT } from "../ObjectBase" ;
4
+ import { OB_ENDPOINT , OBMT } from "../ObjectBase" ;
5
5
import { StateFn , StateMethods } from "./interfaces" ;
6
6
7
7
export const getStateMethods = ( defaultObjectName : string , matches ?: MatchResult < any > ) : StateFn =>
@@ -60,7 +60,7 @@ export const parseObjectStateMapping = (objectStateMapping: string, matches?: Ma
60
60
61
61
export const deleteObjectState = ( obj : any , callback : any ) =>
62
62
async ( propertyName : string ) => {
63
- const result = await obj . fetch ( "/delete" , {
63
+ const result = await obj . fetch ( OB_ENDPOINT + "/delete" , {
64
64
method : "POST" ,
65
65
body : JSON . stringify ( {
66
66
propertyName
@@ -86,7 +86,7 @@ export const deleteObjectState = (obj: any, callback: any) =>
86
86
87
87
export const deleteAllObjectState = ( obj : any , callback : any ) =>
88
88
async ( ) => {
89
- const result = await obj . fetch ( "/deleteall" , {
89
+ const result = await obj . fetch ( OB_ENDPOINT + "/deleteall" , {
90
90
method : "POST"
91
91
} ) ;
92
92
@@ -106,7 +106,7 @@ export const deleteAllObjectState = (obj: any, callback: any) =>
106
106
107
107
export const getObjectState = ( obj : any , callback : any ) =>
108
108
async ( propertyName : string ) => {
109
- const result = await obj . fetch ( "/get" , {
109
+ const result = await obj . fetch ( OB_ENDPOINT + "/get" , {
110
110
method : "POST" ,
111
111
body : JSON . stringify ( {
112
112
propertyName
@@ -132,7 +132,7 @@ export const getObjectState = (obj: any, callback: any) =>
132
132
133
133
export const listObjectState = ( obj : any , callback : any ) =>
134
134
async ( payload : any ) => {
135
- const result = await obj . fetch ( "/list" , {
135
+ const result = await obj . fetch ( OB_ENDPOINT + "/list" , {
136
136
method : "POST" ,
137
137
body : payload ? JSON . stringify ( payload ) : "" ,
138
138
headers : {
@@ -156,7 +156,7 @@ export const listObjectState = (obj: any, callback: any) =>
156
156
157
157
export const putObjectState = ( obj : any , callback : any ) =>
158
158
async ( payload : any ) => {
159
- const result = await obj . fetch ( "/put" , {
159
+ const result = await obj . fetch ( OB_ENDPOINT + "/put" , {
160
160
method : "POST" ,
161
161
body : JSON . stringify ( payload ) ,
162
162
headers : {
0 commit comments