Commit 45857fab by Ravindra Kanojiya

updated header slice

1 parent d4a59b1e
// store/HeaderSlice.js
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import qs from "qs";
export const fetchHeader = createAsyncThunk(
"HeaderSlice/fetchHeader",
"Header/fetchHeader",
async () => {
const query = {
populate: [
"headerLeft",
"headerRight.image",
],
populate: ["headerLeft", "headerRight.image"],
};
const queryString = qs.stringify(query, {
encodeValuesOnly: true,
});
const endpoint = `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/headers?${queryString}`;
const response = await axios.get(endpoint);
return response.data.data;
}
);
......@@ -43,4 +46,5 @@ const HeaderSlice = createSlice({
});
},
});
export default HeaderSlice.reducer;
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!