Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
613 B
1
Indexable
Never
export const updateDifficulties = createAsyncThunk(
  'trainingSession/updateDifficulties',
  async ({ deckId, updatedDifficulties }) => {
    const userId = localStorage.getItem('id');
    if (userId) {
      const response = await axios.patch(
        `${import.meta.env.VITE_API_URL}/account/${userId}/decks/${deckId}/cards/update-difficulties`,
        updatedDifficulties,
        {
          headers: {
            authorization: localStorage.getItem('accessToken'),
          },
        }
      );
      return response.data;
    } else {
      console.log('updatedCard is null or undefined');
    }
  }
);
Leave a Comment