How to use the angular-in-memory-web-api.STATUS.CREATED 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
post(reqInfo: RequestInfo) {
    const collectionName = reqInfo.collectionName;
    if (collectionName === 'notifications' || collectionName === 'subscription') {
      reqInfo.collection[0].push((reqInfo.req as any).body);
      reqInfo.collection[1] = reqInfo.collection[1] + 1;
      const options: ResponseOptions = {
        status: STATUS.CREATED,
      };
      return reqInfo.utils.createResponse$(() => {
        return this.finishOptions(options, reqInfo);
      });
    } else {
      return undefined; // let the default POST handle all others
    }
  }