Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Dec 20, 2023
1 parent b5bab54 commit edbfeaa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
7 changes: 1 addition & 6 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ const config: CodegenConfig = {
documents: 'src/lib/gql/*.drupal.gql',
generates: {
'src/lib/gql/__generated__/drupal.ts': {
plugins: ['typescript', 'typescript-operations', 'typescript-graphql-request'],
config: {
fetcher: {
func: '../fetcher#gqlFetcher'
}
}
plugins: ['typescript', 'typescript-operations', 'typescript-graphql-request']
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/wysiwyg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const cleanMediaMarkup = (node: Element) => {
const getOembedUrl = (node: Element): string | undefined => {
const src = node.attribs?.src || node.attribs['data-src'];
if (src?.startsWith('/media/oembed')) {
return decodeURIComponent(src as string).replaceAll(/^.*url=(.*)?&.*$/, '$1');
return decodeURIComponent(src as string).replace(/^.*url=(.*)?&.*$/, '$1');
}
if (node.children.length > 0) {
for (let child of node.children) {
Expand Down
5 changes: 1 addition & 4 deletions src/lib/gql/fetcher.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import {getSdk} from "@lib/gql/__generated__/drupal";
import {GraphQLClient} from "graphql-request";


export const graphqlClient = (accessToken?: string) => {

const headers: Record<string, string> = {'Content-Type': 'application/json'}
if (accessToken) headers.Authorization = `Bearer ${accessToken}`

const client = new GraphQLClient(
process.env.NEXT_PUBLIC_DRUPAL_BASE_URL + '/graphql',
{
headers
}
{headers}
)
return getSdk(client);
}

0 comments on commit edbfeaa

Please sign in to comment.