@@ -69,6 +69,13 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
6969 return Promise . reject ( new Error ( `Could not perform POST, "${ uriOrCollection } " is not an entity or URI` ) )
7070 }
7171
72+ if ( ! isUnknown ( uri ) ) {
73+ const entity = get ( uri )
74+ if ( isVirtualResource ( entity ) ) {
75+ return Promise . reject ( new Error ( 'post is not implemented for virtual resources' ) )
76+ }
77+ }
78+
7279 return axios . post ( axios . defaults . baseURL + uri , data ) . then ( ( { data, status } ) => {
7380 if ( status === 204 ) {
7481 return null
@@ -262,6 +269,13 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
262269 }
263270 const existsInStore = ! isUnknown ( uri )
264271
272+ if ( existsInStore ) {
273+ const entity = get ( uri )
274+ if ( isVirtualResource ( entity ) ) {
275+ return Promise . reject ( new Error ( 'patch is not implemented for virtual resources' ) )
276+ }
277+ }
278+
265279 if ( ! existsInStore ) {
266280 store . commit ( 'addEmpty' , uri )
267281 }
@@ -320,6 +334,14 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
320334 // Can't delete an unknown URI, do nothing
321335 return Promise . reject ( new Error ( `Could not perform DELETE, "${ uriOrEntity } " is not an entity or URI` ) )
322336 }
337+
338+ if ( ! isUnknown ( uri ) ) {
339+ const entity = get ( uri )
340+ if ( isVirtualResource ( entity ) ) {
341+ return Promise . reject ( new Error ( 'del is not implemented for virtual resources' ) )
342+ }
343+ }
344+
323345 store . commit ( 'deleting' , uri )
324346 return axios . delete ( axios . defaults . baseURL + uri ) . then (
325347 ( ) => deleted ( uri ) ,
0 commit comments