{
    "Redux Slice": {
      "prefix": ["pvtSlice"],
      "body": 
      [
        "import { createSlice} from '@reduxjs/toolkit';",
        " ",
        "const ${TM_FILENAME_BASE}InitialState = ",
        "{",
        "\t ",
        "\t ",
        "}",
        " ",
        "export const ${TM_FILENAME_BASE}Slice =  createSlice({",
        "\tname: '${TM_FILENAME_BASE}',",
        "\tinitialState: ${TM_FILENAME_BASE}InitialState,",
        "\treducers :",
        "\t{",
        " ",
        "\t}",
        "});",
        " ",
        "export const { } = ${TM_FILENAME_BASE}Slice.actions;"
    ],
      "description": "Create a new UI slice for redux toolkit"
    },

    "Redux Boolean": {
        "prefix": "pvtBool",
        "body": 
        [
            "//${1:var} Initial state",
            "${1:var}  : false,",
            " ",
            "//${1:var}  Reducer",
            "toggle${1:var}State : (state) =>",
            "{",
            "\tif(state.${1:var}  === true){state.${1:var} = false}",
            "\telse{state.${1:var} = true}",
            "}",
            "//Export ${1:var} current state",
            "export const select${1:var}State  = (state) => state.${TM_FILENAME_BASE}.${1:var};"
          
        ],
        "description": "Redux Boolean"
      },

      "Redux List": {
        "prefix": "pvtList",
        "body": 
        [
            "//${1:listVar} Initial state",
            "${1:listVar} : [],",
            " ",
            "//Add to ${1:listVar} Reducer",
            "addTo${1:listVar}State : (state, action) =>",
            "{",
            "\tstate.${1:listVar}.push(action.payload)",            
            "},",
			" ",
			"//Remove from ${1:listVar} Reducer",
            "removeFrom${1:listVar}State : (state, action) =>",
            "{",
            "\tstate.${1:listVar} = state.${1:listVar}.filter((item) => item !== action.payload);",
            "}",
			" ",
            "//Export ${1:listVar} current state",
            "export const select${1:listVar}State  = (state) => state.${TM_FILENAME_BASE}.${1:listVar};",
			" ",
			"//Export ${1:listVar} actions",
			"addTo${1:listVar}State , removeFrom${1:listVar}State "

        ],
        "description": "Redux List"
      },
      "Redux Variable": {
        "prefix": "pvtVar",
        "body": 
        [
            "//${1:var} Initial state",
            "${1:var} : ' ',",
            " ",
            "//${1:var} Reducer",
            "update${1:var}State : (state, action) =>",
            "{",
            "\tstate.${1:var} = action.payload",            
            "}",
            "//Export ${1:var} current state",
            "export const select${1:var}State  = (state) => state.${TM_FILENAME_BASE}.${1:var};"
        ],
        "description": "Redux List"
      },
      "ReduxToolkit with analytics":{
        "prefix" : "pvtAl",
        "body": [
          "import React from 'react';",
          "import styled from 'styled-components';",
          "import { useLocation } from 'react-router-dom';",
          "import {useSelector, useDispatch } from 'react-redux';",
          "\n\n\nconst Container = styled.div`",
          "height: 100vh;",
          "width: 100vw;",
          "display:block;",
          "`;",
          " ",
          "const ${1:${TM_FILENAME_BASE}} = () => {",
          "\tconst dispatch = useDispatch()",
          "\tconst location = useLocation();",
          "\tconst currentTime = Date.now();",
          "\tconst pageDetails = {'path':location.pathname, 'time': currentTime};",
          "\nreturn(",
          "\t<Container>${1:${TM_FILENAME_BASE}} Pivot</Container>",
          ")",
          "}\n\n\n",
          "export default ${1:${TM_FILENAME_BASE}}"


        ],
        "description": "Create jsx file with redux toolkit, styled-components and analytics"
      },

      "RTKQuery Api Slice": {
        "prefix": "pvtAPI",
        "body": [
          "import {createApi, fetchBaseQuery} from '@reduxjs/toolkit/query/react';",
          "",
          "const baseUrl = 'http://localhost:6253'; //Node Server",
          "",
          "const baseQuery = fetchBaseQuery({",
          "  baseUrl: baseUrl,",
          "  credentials:'same-origin', //Change to credentials:'include'",
          "  prepareHeaders: (headers, { getState }) => ",
          "  {",
          "    /*Add Headers*/",
          "    return headers",
          "  }",
          "})",
          "",
          "export const ${1:${TM_FILENAME_BASE}} = createApi({",
          "  reducerPath : '${1:${TM_FILENAME_BASE}}',",
          "  baseQuery: baseQuery,",
          "  endpoints: builder => ({})",
          "})"
        ],
        "description": "RTKQuery Api Slice"
      },

      "RTKQuery Api Inject Endpoints": {
        "prefix": "pvtInject",
        "body": [
          "//import { ReduxApi } from '../../../Redux/ReduxApi' ",
          "",
          "export const ${1:${TM_FILENAME_BASE}} = ReduxApi.injectEndpoints({",
          "    endpoints: builder => ",
          "    ({",
          "        ",
          "    })",
          "})",
          "export const { } = ${1:${TM_FILENAME_BASE}}"
        ],
        "description": "RTKQuery Api Inject Endpoints"
      },

      "RTKQuery Post": {
        "prefix": "pvtPost",
        "body": [
          "//Press Tab to Save",
          "//$post{1} POST request",
          "${1}  : builder.mutation({",
          "            query: (builder) => ({",
          "                url: ' ',",
          "                method: 'POST',",
          "                body: builder",
          "            })",
          "        }),",
          "",
          "//add to export",
          "//use${1/(.*)/${1:/capitalize}/}Mutation"
        ],
        "description": "RTKQuery Post"
      },
      
      "RTKQuery Get": {
        "prefix": "pvtGet",
        "body": [
          "//${1} GET request",
          "get${1}  : builder.query({",
          "            query: () => ({",
          "                url: ' ',",
          "                method: 'GET',",
          "            })",
          "        }),",
          "",
          "//add to export",
          "//useGet${1/(.*)/${1:/capitalize}/}Query"
        ],
        "description": "RTKQuery Get"
      }

}
