Skip to content

image_reducer

Anoop Nair edited this page Nov 15, 2021 · 2 revisions

Introduction

This file contains all the redux reducers for images. Immer is used to handle immutable state.

ADD_IMAGES

  • Map through action.payload.images
  • If action.payload.type is CAMERA || GALLERY the shape of image object is same
 id:
 lat:
 lon:
 uri: 
 filename: 
 date:
 type:    -->  CAMERA || GALLERY || WEB
 selected:
 tags: 
 pickedUp: 
  • If type is WEB
    • check if image with same photoId already exist in state, if not add it to images array.
    • the shape of image object is different. WEB images don't have lat/long properties but they are geotagged because web app only accepts geotagged images.
 id:
 uri: 
 filename: 
 type:    -->  CAMERA || GALLERY || WEB
 selected:
 tags: 
 pickedUp:
 photoId:    -->  Id of image uploaded from web
Action
Reducer
Clone this wiki locally