import { createAsyncThunk } from "@reduxjs/toolkit";
import { getAuthenticationCode } from "../../api/deviceApi";

export const fetchAuthenticationCode = createAsyncThunk(
  "auth/fetchAuthenticationCode",

  async (_, { rejectWithValue }) => {
    try {
      const response = await getAuthenticationCode();

      return response.data.accessToken;
    } catch (error) {
      return rejectWithValue("unknown Error");
    }
  }
);
