How to use the angular-in-memory-web-api.STATUS.ACCEPTED function in angular-in-memory-web-api

To help you get started, we’ve selected a few angular-in-memory-web-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xmlking / ngx-starter-kit / apps / webapp / src / app / in-memory-data.service.ts View on Github external
put(reqInfo: RequestInfo) {
    const collectionName = reqInfo.collectionName;
    if (collectionName === 'accounts') {
      (reqInfo.req as any).body = { id: reqInfo.id, ...(reqInfo.req as any).body };
    } else if (collectionName === 'notifications' || collectionName === 'subscription') {
      reqInfo.collection[0].map(item => {
        if (item.id === reqInfo.id) {
          return { id: reqInfo.id, ...(reqInfo.req as any).body };
        }
        return item;
      });
      const options: ResponseOptions = {
        status: STATUS.ACCEPTED,
      };
      return reqInfo.utils.createResponse$(() => {
        return this.finishOptions(options, reqInfo);
      });
    } else {
      return undefined; // let the default PUT handle all others
    }
  }