Browse Source

refactor(admin-ui): Move gql definition to more relevant file

Michael Bromley 6 years ago
parent
commit
d86f3d3169

+ 0 - 12
admin-ui/src/app/data/definitions/settings-definitions.ts

@@ -589,15 +589,3 @@ export const SEARCH_FOR_TEST_ORDER = gql`
         }
     }
 `;
-
-export const TEST_SHIPPING_METHOD = gql`
-    query TestShippingMethod($input: TestShippingMethodInput!) {
-        testShippingMethod(input: $input) {
-            eligible
-            price {
-                price
-                priceWithTax
-            }
-        }
-    }
-`;

+ 12 - 0
admin-ui/src/app/data/definitions/shipping-definitions.ts

@@ -69,3 +69,15 @@ export const UPDATE_SHIPPING_METHOD = gql`
     }
     ${SHIPPING_METHOD_FRAGMENT}
 `;
+
+export const TEST_SHIPPING_METHOD = gql`
+    query TestShippingMethod($input: TestShippingMethodInput!) {
+        testShippingMethod(input: $input) {
+            eligible
+            price {
+                price
+                priceWithTax
+            }
+        }
+    }
+`;

+ 0 - 12
admin-ui/src/app/data/providers/settings-data.service.ts

@@ -34,8 +34,6 @@ import {
     JobState,
     RemoveMembersFromZone,
     SearchForTestOrder,
-    TestShippingMethod,
-    TestShippingMethodInput,
     UpdateChannel,
     UpdateChannelInput,
     UpdateCountry,
@@ -77,7 +75,6 @@ import {
     GET_ZONES,
     REMOVE_MEMBERS_FROM_ZONE,
     SEARCH_FOR_TEST_ORDER,
-    TEST_SHIPPING_METHOD,
     UPDATE_CHANNEL,
     UPDATE_COUNTRY,
     UPDATE_GLOBAL_SETTINGS,
@@ -324,13 +321,4 @@ export class SettingsDataService {
             },
         );
     }
-
-    testShippingMethod(input: TestShippingMethodInput) {
-        return this.baseDataService.query<TestShippingMethod.Query, TestShippingMethod.Variables>(
-            TEST_SHIPPING_METHOD,
-            {
-                input,
-            },
-        );
-    }
 }

+ 12 - 0
admin-ui/src/app/data/providers/shipping-method-data.service.ts

@@ -4,6 +4,8 @@ import {
     GetShippingMethod,
     GetShippingMethodList,
     GetShippingMethodOperations,
+    TestShippingMethod,
+    TestShippingMethodInput,
     UpdateShippingMethod,
     UpdateShippingMethodInput,
 } from '../../common/generated-types';
@@ -12,6 +14,7 @@ import {
     GET_SHIPPING_METHOD,
     GET_SHIPPING_METHOD_LIST,
     GET_SHIPPING_METHOD_OPERATIONS,
+    TEST_SHIPPING_METHOD,
     UPDATE_SHIPPING_METHOD,
 } from '../definitions/shipping-definitions';
 
@@ -62,4 +65,13 @@ export class ShippingMethodDataService {
             },
         );
     }
+
+    testShippingMethod(input: TestShippingMethodInput) {
+        return this.baseDataService.query<TestShippingMethod.Query, TestShippingMethod.Variables>(
+            TEST_SHIPPING_METHOD,
+            {
+                input,
+            },
+        );
+    }
 }

+ 1 - 1
admin-ui/src/app/settings/components/shipping-method-detail/shipping-method-detail.component.ts

@@ -100,7 +100,7 @@ export class ShippingMethodDetailComponent extends BaseDetailComponent<ShippingM
                         formValue.calculator,
                     ),
                 };
-                return this.dataService.settings
+                return this.dataService.shippingMethod
                     .testShippingMethod(input)
                     .mapSingle(result => result.testShippingMethod);
             }),