fix: 🐛 split privateMetadata and publicMetadata
This commit is contained in:
parent
547e773500
commit
79a1411a55
4 changed files with 18 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
mutation UpdateMetadata($id: ID!, $input: [MetadataInput!]!) {
|
mutation UpdatePrivateMetadata($id: ID!, $input: [MetadataInput!]!) {
|
||||||
updatePrivateMetadata(id: $id, input: $input) {
|
updatePrivateMetadata(id: $id, input: $input) {
|
||||||
item {
|
item {
|
||||||
privateMetadata {
|
privateMetadata {
|
10
apps/taxes/graphql/mutations/UpdatePublicMetadata.graphql
Normal file
10
apps/taxes/graphql/mutations/UpdatePublicMetadata.graphql
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
mutation UpdatePublicMetadata($id: ID!, $input: [MetadataInput!]!) {
|
||||||
|
updateMetadata(id: $id, input: $input) {
|
||||||
|
item {
|
||||||
|
metadata {
|
||||||
|
key
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import { Client, gql } from "urql";
|
||||||
import {
|
import {
|
||||||
FetchAppDetailsDocument,
|
FetchAppDetailsDocument,
|
||||||
FetchAppDetailsQuery,
|
FetchAppDetailsQuery,
|
||||||
UpdateMetadataDocument,
|
UpdatePrivateMetadataDocument,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../generated/graphql";
|
||||||
|
|
||||||
gql`
|
gql`
|
||||||
|
@ -45,7 +45,7 @@ export async function fetchAllMetadata(client: Client): Promise<MetadataEntry[]>
|
||||||
|
|
||||||
export async function mutateMetadata(client: Client, metadata: MetadataEntry[], appId: string) {
|
export async function mutateMetadata(client: Client, metadata: MetadataEntry[], appId: string) {
|
||||||
const { error: mutationError, data: mutationData } = await client
|
const { error: mutationError, data: mutationData } = await client
|
||||||
.mutation(UpdateMetadataDocument, {
|
.mutation(UpdatePrivateMetadataDocument, {
|
||||||
id: appId,
|
id: appId,
|
||||||
input: metadata,
|
input: metadata,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Client } from "urql";
|
import { Client } from "urql";
|
||||||
import {
|
import {
|
||||||
UpdateMetadataDocument,
|
UpdatePublicMetadataDocument,
|
||||||
UpdateMetadataMutation,
|
UpdatePublicMetadataMutation,
|
||||||
UpdateMetadataMutationVariables,
|
UpdatePublicMetadataMutationVariables,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../generated/graphql";
|
||||||
|
|
||||||
const PROVIDER_ORDER_ID_KEY = "avataxId";
|
const PROVIDER_ORDER_ID_KEY = "avataxId";
|
||||||
|
@ -17,7 +17,7 @@ export class OrderMetadataManager {
|
||||||
* update the provider order when the Saleor order is fulfilled.
|
* update the provider order when the Saleor order is fulfilled.
|
||||||
*/
|
*/
|
||||||
async updateOrderMetadataWithExternalId(orderId: string, externalId: string) {
|
async updateOrderMetadataWithExternalId(orderId: string, externalId: string) {
|
||||||
const variables: UpdateMetadataMutationVariables = {
|
const variables: UpdatePublicMetadataMutationVariables = {
|
||||||
id: orderId,
|
id: orderId,
|
||||||
input: [
|
input: [
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ export class OrderMetadataManager {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const { error } = await this.client
|
const { error } = await this.client
|
||||||
.mutation<UpdateMetadataMutation>(UpdateMetadataDocument, variables)
|
.mutation<UpdatePublicMetadataMutation>(UpdatePublicMetadataDocument, variables)
|
||||||
.toPromise();
|
.toPromise();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in a new issue