import { Login } from '@/services/user';

export default {
  namespace: 'login',

  state: {},

  effects: {
    *login({ payload, callback }, { call, put }) {
      try {
        let response = null;
        response = yield call(Login, payload);
        const { user, token } = response.data;

        callback?.(token);
        // yield put({
        //   type: 'changeLoginStatus',
        //   payload: response,
        // });
      } catch (error) {
        console.error(error);
      }
    },
  },

  reducers: {},
};
