Skip to content

Commit

Permalink
fix : create Ingredient buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
kth1888 committed Aug 24, 2023
1 parent e78f73b commit 49d81ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 89e904228d0524eebbff9d8903d0fb1a, type: 3}
m_Name:
m_EditorClassIdentifier:
svrReference: {fileID: 11400000, guid: 38e7c9c0fffe34996ae8cf5c6c4417ee, type: 2}
privateKeyHex: eda6ef63ae945cd15572fcf7d6635a8b3f8d86e85b57a353b482bc82c7fd2ad4
seedStateId: {fileID: 8778449230615227800}
seedId: {fileID: 8778449230942835930}
IngredientCreateButton: {fileID: 8778449231450303529}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public void CancelSubscribe()
public async void CreateNewSeed()
{
GraphApi.Query query = svrReference.GetQueryByName("CreateNewSeed", GraphApi.Query.Type.Mutation);
query.SetArgs(new { address });
query.SetArgs(new { privateKeyHex });
UnityWebRequest request = await svrReference.Post(query);
}
Expand Down
13 changes: 11 additions & 2 deletions frontend/Savor-22b/Assets/Scripts/Inventory/SeedUI.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using GraphQlClient.Core;
using GraphQlClient.EventCallbacks;
using UnityEngine.Networking;

public class SeedUI : MonoBehaviour
{
[Header("API")]
public GraphApi svrReference;
public string privateKeyHex;

public Text seedStateId;
public Text seedId;

Expand All @@ -17,9 +24,11 @@ public void SetSeedData(Seed seed)
SetIngredientCreateButton(seed.stateId);
}

public void CreateIngredient(Guid seedStateId)
public async void CreateIngredient(Guid seedStateId)
{
Debug.Log("Create ingredient");
GraphApi.Query query = svrReference.GetQueryByName(QueryNames.CREATE_INGREDIENT, GraphApi.Query.Type.Mutation);
query.SetArgs(new { privateKeyHex, seedStateId });
UnityWebRequest request = await svrReference.Post(query);
}

public void SetIngredientCreateButton(Guid seedStateId)
Expand Down
1 change: 1 addition & 0 deletions frontend/Savor-22b/Assets/Scripts/Models/QueryNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
public static class QueryNames
{
public static readonly string GET_ALL_RECIPE = "GetAllRecipe";
public static readonly string CREATE_INGREDIENT = "CreateNewIngredient";
}

0 comments on commit 49d81ae

Please sign in to comment.