-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
const Custom404 = () => { | ||
return ( | ||
<div> | ||
<h1>404 - Page Not Found</h1> | ||
<p>Sorry, the page you are looking for cannot be found.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Custom404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { NextPageContext } from 'next'; | ||
|
||
type Props = { | ||
statusCode: number; | ||
}; | ||
|
||
const ErrorPage = ({ statusCode }: Props) => { | ||
if (statusCode === 404) { | ||
return ( | ||
<div> | ||
<h1>404 - Page Not Found</h1> | ||
<p>Sorry, the page you are looking for cannot be found.</p> | ||
</div> | ||
); | ||
} else if (statusCode === 500) { | ||
return ( | ||
<div> | ||
<h1>500 - Internal Server Error</h1> | ||
<p>Sorry, there was a problem with the server.</p> | ||
</div> | ||
); | ||
} else { | ||
return ( | ||
<div> | ||
<h1> | ||
{statusCode | ||
? `An error ${statusCode} occurred on server` | ||
: 'An error occurred on client'} | ||
</h1> | ||
<p>Sorry, there was a problem with the server.</p> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
ErrorPage.getInitialProps = ({ res, err }: NextPageContext) => { | ||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404; | ||
return { statusCode }; | ||
}; | ||
|
||
export default ErrorPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
// src/redux/rootReducer.ts | ||
|
||
import {persistReducer} from 'redux-persist'; | ||
import storage from "redux-persist/lib/storage"; | ||
import { combineReducers } from '@reduxjs/toolkit'; | ||
import postReducer from './posts/reducer'; /// Import your postReducer | ||
// Import other reducers as needed | ||
|
||
const persistConfig = { | ||
key: 'root', | ||
storage, | ||
whitelist: [] | ||
}; | ||
|
||
const rootReducer = combineReducers({ | ||
// Add your individual reducers here | ||
posts: postReducer, // Assuming you have a 'posts' slice in your state | ||
// Add more reducers for other parts of your app here | ||
}); | ||
|
||
export default rootReducer; | ||
export default persistReducer(persistConfig, rootReducer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters