Change Active/Blocked user status by selecting checkboxes in users table in react

Viewed 16

i want to select user in table with checkboxes and change their status to Active/Blocked. I wrote a code which changing the user status but not persistent. When i login again their status still remaining same before i changed. Can anyone help how to do that? Here is What U/I should look like :

enter image description here

Active should change to Block, Block to Active. It would be great if suggested solutions starts from backend smth like that :

import mongoose from "mongoose";
const { Schema, model } = mongoose;
const userSchema = new Schema(
  {
    name: { type: String },
    email: { type: String, unique: true},
    password: { type: String },
    status: {type: String, enum:["Active", "Blocked"], default:"Active"},
    token: { type: String },
    lastLogin: { type: Date, default: Date.now},
  },
  { timestamps: true }
);
export default model("User", userSchema);

Or should i implement only in front end?

0 Answers
Related