// /redux/thunks/database/getDeviceIdByNameThunk.js

import { createAsyncThunk } from "@reduxjs/toolkit";
import { getDeviceIdByNameService } from "../../../services/database/getDeviceIdByNameService";

export const getDeviceIdByNameThunk = createAsyncThunk("devices/getIdByName", async (deviceName, thunkAPI) => {
  try {
    return await getDeviceIdByNameService(deviceName);
  } catch (error) {
    return thunkAPI.rejectWithValue(error.message);
  }
});
