Skip to content

Instantly share code, notes, and snippets.

@zzdjk6
Created August 19, 2018 23:29
Show Gist options
  • Save zzdjk6/2ad61939936971dad0d71fb3f0211df6 to your computer and use it in GitHub Desktop.
Save zzdjk6/2ad61939936971dad0d71fb3f0211df6 to your computer and use it in GitHub Desktop.
Persisted GraphQL Queries with axios and SilverStripe 4: YAML config
SilverStripe\GraphQL\PersistedQuery\JSONStringProvider:
mapping_with_key:
default: '{"mutation($songID:Int,$playlistID:Int){addSongToPlaylist(SongID:$songID,PlaylistID:$playlistID){ID ClassName LastEdited Created Title Description NumberOfSongs}}":"eaa0ae5c-818a-4cb4-936d-50da2fe3c9a9","mutation($input:ModelPlaylistCreateInputType!){createPlaylist(Input:$input){ID ClassName LastEdited Created Title Description NumberOfSongs}}":"75390ddb-8573-41dc-a956-abddad50b1b5","mutation($email:String!,$password:String!){createToken(Email:$email,Password:$password){ID FirstName Surname Email Token}}":"78b0294c-d6af-4922-9a88-7cb49626a2f9","query{readPlaylists{ID ClassName LastEdited Created Title Description NumberOfSongs}}":"934da2a0-3c04-4f54-baff-2e89598b84cb","query{readSongs{ID Title Length Artist Album Disc Track StreamFileURL}}":"683e444c-c393-46db-9deb-fc2a46ef5107","query($playlistID:ID!){readOnePlaylist(ID:$playlistID){ID ClassName LastEdited Created Title Description Songs{ID ClassName LastEdited Created Title Length Artist Album Disc Track StreamFileURL}}}":"8b8e7252-22fc-4291-a3fa-a6df3bb4a89a","query($id:ID!){readOneSong(ID:$id){TXTLyric LRCLyric}}":"031cdb73-d0cf-40cf-860e-de4e0628fbc0","mutation($playlistIDs:[ID]!){deletePlaylist(IDs:$playlistIDs){ID}}":"acc4e86e-466b-41fa-b518-44956eaaf3e6","mutation($songID:Int,$playlistID:Int){removeSongFromPlaylist(SongID:$songID,PlaylistID:$playlistID){ID ClassName LastEdited Created Title Description NumberOfSongs}}":"2fea7ff2-17f4-4948-8475-307764c7a8ae"}'
SilverStripe\Core\Injector\Injector:
SilverStripe\GraphQL\PersistedQuery\PersistedQueryMappingProvider:
class: SilverStripe\GraphQL\PersistedQuery\JSONStringProvider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment