-
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.
Improve Next.js JSON deserisation and Run object handling
See this thread: vercel/next.js#11993
- Loading branch information
Showing
11 changed files
with
249 additions
and
118 deletions.
There are no files selected for viewing
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,4 +1,4 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": ["react-optimized-image/plugin", "@babel/plugin-proposal-class-properties"] | ||
"plugins": ["react-optimized-image/plugin", "@babel/plugin-proposal-class-properties", "superjson-next"] | ||
} |
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
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,63 @@ | ||
|
||
import SocialPostRunResult from './SocialPostRunResult'; | ||
|
||
// This class is pretty gross, but it works... | ||
class SocialPostRun { | ||
notionPageId:string | ||
subreddit:string // eg newzealand | ||
primaryUrlParam:string | ||
textUrlParams:string[] | ||
|
||
type:string // "Reddit_Comment", "Reddit_Comment" | ||
createdDate:string | ||
flairId?:string | ||
|
||
existingPostTitle?:string | ||
existingPostId?:string | ||
lastCheckTime?:string | ||
|
||
result?:SocialPostRunResult | ||
error?:any | ||
|
||
constructor ( | ||
notionPageId:string | ||
,subreddit:string | ||
,primaryUrlParam:string | ||
, textUrlParams:string[] | ||
,type:string | ||
, existingPostTitle?:string | ||
,existingPostId?:string | ||
,lastCheckTime?:string | ||
,flairId?:string | ||
){ | ||
|
||
this.notionPageId = notionPageId; | ||
this.subreddit = subreddit; | ||
this.primaryUrlParam = primaryUrlParam; | ||
this.textUrlParams = textUrlParams; | ||
if(existingPostTitle){ | ||
this.existingPostTitle = existingPostTitle; | ||
} | ||
if(existingPostId){ | ||
this.existingPostId = existingPostId; | ||
} | ||
if(flairId){ | ||
this.flairId = flairId | ||
} | ||
|
||
this.createdDate = new Date().toISOString(); | ||
this.type = type | ||
this.lastCheckTime = lastCheckTime; | ||
} | ||
|
||
|
||
setError(err:any) { | ||
this.error(err); | ||
} | ||
|
||
setResults(result:SocialPostRunResult){ | ||
this.result = result | ||
} | ||
} | ||
|
||
export default SocialPostRun; |
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,4 @@ | ||
enum PostRunType { | ||
RedditPost = "RedditPost", | ||
RedditComment = "RedditComment", | ||
} |
This file was deleted.
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
Oops, something went wrong.