Skip to content

Commit

Permalink
chore(services/types): renamed variables and methods for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Dec 12, 2022
1 parent ab5ef60 commit 4807ea7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/services/fileServices/MdPageServices/PageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { UnlinkedPageService } from "./UnlinkedPageService"
// this should return a sum type of the possible errors.
// This is (at a glance), either a failure to read from github
// or the parsing fails (we have a sentinel value of an empty string)
const withError = (promise: Promise<PageInfo>) =>
const withErrorHandler = (promise: Promise<PageInfo>) =>
ResultAsync.fromPromise(promise, () => new BaseIsomerError()).andThen(
(data) =>
// NOTE: This is a fail-safe check as `yaml.parse`
Expand Down Expand Up @@ -325,15 +325,15 @@ export class PageService {
// the service method will automatically append an `_`
// in front of the collection name (which is reflected in the raw name here).
case "CollectionPage": {
return withError(
return withErrorHandler(
this.collectionPageService.read(sessionData, {
fileName: pageName.name,
collectionName: pageName.collection.slice(1),
})
).map(withPermalink)
}
case "SubcollectionPage": {
return withError(
return withErrorHandler(
this.subCollectionPageService.read(sessionData, {
fileName: pageName.name,
collectionName: pageName.collection.slice(1),
Expand All @@ -342,7 +342,7 @@ export class PageService {
).map(withPermalink)
}
case "ResourceCategoryPage": {
return withError(
return withErrorHandler(
this.resourcePageService.read(sessionData, {
fileName: pageName.name,
resourceCategoryName: pageName.resourceCategory,
Expand All @@ -351,21 +351,21 @@ export class PageService {
).map(withPermalink)
}
case "Homepage": {
return withError(
return withErrorHandler(
this.homepageService
.read(sessionData)
.then((homepage) => homepage as Homepage)
).map(withPermalink)
}
case "ContactUsPage": {
return withError(
return withErrorHandler(
this.contactUsService
.read(sessionData)
.then((contactUsPage) => contactUsPage as ContactUsPage)
).map(withPermalink)
}
case "UnlinkedPage": {
return withError(
return withErrorHandler(
this.unlinkedPageService.read(sessionData, {
fileName: pageName.name,
})
Expand Down
2 changes: 1 addition & 1 deletion src/types/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type ProdPermalink = Brand<string, "prod">

// NOTE: This is not `frontMatter.permalink` as this
// also includes the respective base url in front.
export type Permalink = StagingPermalink | ProdPermalink
export type FullPermalink = StagingPermalink | ProdPermalink

export type PathInfo = {
name: string
Expand Down

0 comments on commit 4807ea7

Please sign in to comment.