front and back work

This commit is contained in:
QkoSad
2023-07-29 18:29:41 +03:00
parent 40051f9d5e
commit 2fee49e583
9 changed files with 29 additions and 26 deletions
+2 -4
View File
@@ -25,13 +25,11 @@ store.subscribe(() => {
// if the token changes set the value in localStorage and axios headers
if (previousState.auth.token !== currentState.auth.token) {
const token = currentState.auth.token;
if (typeof token === 'string') setAuthToken(token);
else throw new Error("token not string")
setAuthToken(token);
}
});
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch
export default store;