@@ -1,10 +1,11 @@
|
||||
import { useMutation, useFlash } from '@redwoodjs/web'
|
||||
import { navigate, routes } from '@redwoodjs/router'
|
||||
// import Part from 'src/components/Part'
|
||||
import IdeCascadeStudio from 'src/components/IdeCascadeStudio'
|
||||
// import Part from 'src/components/Part'a
|
||||
|
||||
export const QUERY = gql`
|
||||
query FIND_PART_BY_ID($id: Int!) {
|
||||
part: part(id: $id) {
|
||||
query FIND_PART_BY_USENAME_TITLE($partTitle: String!, $userName: String!) {
|
||||
part: partByUserAndTitle(partTitle: $partTitle, userName: $userName) {
|
||||
id
|
||||
title
|
||||
description
|
||||
@@ -16,7 +17,7 @@ export const QUERY = gql`
|
||||
`
|
||||
|
||||
const UPDATE_PART_MUTATION = gql`
|
||||
mutation UpdatePartMutation($id: Int!, $input: UpdatePartInput!) {
|
||||
mutation UpdatePartMutation($id: String!, $input: UpdatePartInput!) {
|
||||
updatePart(id: $id, input: $input) {
|
||||
id
|
||||
}
|
||||
@@ -27,7 +28,7 @@ export const Loading = () => <div>Loading...</div>
|
||||
|
||||
export const Empty = () => <div>Part not found</div>
|
||||
|
||||
export const Success = ({ part }) => {
|
||||
export const Success = ({ part, refetch }) => {
|
||||
const { addMessage } = useFlash()
|
||||
const [updatePart, { loading, error }] = useMutation(UPDATE_PART_MUTATION, {
|
||||
onCompleted: () => {
|
||||
@@ -40,7 +41,14 @@ export const Success = ({ part }) => {
|
||||
const saveCode = (input, id) => {
|
||||
console.log(id, input, 'wowow')
|
||||
updatePart({ variables: { id, input } })
|
||||
refetch()
|
||||
}
|
||||
return <div>TODO part</div>
|
||||
// return <Part part={{...part, code: part.code}} saveCode={saveCode} loading={loading} error={error} />
|
||||
return (
|
||||
<IdeCascadeStudio
|
||||
part={part}
|
||||
saveCode={saveCode}
|
||||
loading={loading}
|
||||
error={error}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user