-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #624 from AmericanWhitewater/feature/read-new-mark…
…down-fields Feature/read new markdown fields
- Loading branch information
Showing
13 changed files
with
118 additions
and
102 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 |
---|---|---|
|
@@ -11,7 +11,6 @@ export async function createReach(data) { | |
class | ||
county | ||
description | ||
gaugeinfo | ||
geom | ||
id | ||
length | ||
|
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,40 +1,53 @@ | ||
import http from "@/app/http" | ||
import { marked } from 'marked'; | ||
|
||
export async function getRapids(id) { | ||
return http | ||
.post('graphql', { | ||
query: ` | ||
query { | ||
reach(id: ${id}) { | ||
pois { | ||
approximate | ||
character | ||
description | ||
difficulty | ||
distance | ||
id | ||
name | ||
rloc | ||
photo { | ||
poi_name | ||
subject | ||
description | ||
author | ||
caption | ||
photo_date | ||
image { | ||
uri { | ||
thumb | ||
medium | ||
big | ||
} | ||
} | ||
id | ||
} | ||
} | ||
} | ||
query { | ||
reach(id: ${id}) { | ||
pois { | ||
approximate | ||
character | ||
description_md | ||
difficulty | ||
distance | ||
id | ||
name | ||
rloc | ||
photo { | ||
poi_name | ||
subject | ||
description | ||
author | ||
caption | ||
photo_date | ||
image { | ||
uri { | ||
thumb | ||
medium | ||
big | ||
} | ||
` | ||
} | ||
id | ||
} | ||
} | ||
} | ||
} | ||
` | ||
}) | ||
.then(res => { | ||
// overwrite `description` with a parsed version of the markdown database field | ||
// this allows us to read and render the markdown field while leaving the edit/update | ||
// code unchanged | ||
// TODO: move fully to the _md fields, including with a new editor | ||
if (!res.data.errors) { | ||
res.data.data.reach.pois.forEach((poi) => { | ||
poi.description = marked.parse(poi.description_md); | ||
}); | ||
|
||
} | ||
return res.data; | ||
}) | ||
.then(res => res.data) | ||
} |
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
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
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 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