16 lines
470 B
TypeScript
16 lines
470 B
TypeScript
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
import { toggleStatus as toggleStatusApi } from '@api';
|
|
import { ToggleStatusPayload } from '@interfaces';
|
|
|
|
export const toggleStatus = createAsyncThunk(
|
|
'dashboard/toggleStatus',
|
|
async (payload: ToggleStatusPayload, { rejectWithValue }) => {
|
|
try {
|
|
const response = await toggleStatusApi(payload);
|
|
return response;
|
|
} catch (error: unknown) {
|
|
return rejectWithValue(error);
|
|
}
|
|
},
|
|
);
|