Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/get balance #2187

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/AddContentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ const handleSubmitForm = async (
Authorization: lsatToken,
})

await updateBudget(setBudget)

if (res.data.project_id) {
setRunningProjectId(res.data.project_id)
}
Expand All @@ -127,7 +129,7 @@ const handleSubmitForm = async (
} catch (err: any) {
if (err.status === 402) {
await payLsat(setBudget)
await updateBudget(setBudget)

await handleSubmitForm(data, sourceType, setBudget, setRunningProjectId)
} else {
let errorMessage = NODE_ADD_ERROR
Expand Down
8 changes: 4 additions & 4 deletions src/components/Auth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@
setPubKey('')
}

await updateBudget(setBudget)

if (isE2E || isDevelopment) {
setIsAuthenticated(true)
}
}, [setBudget, setPubKey, setIsAuthenticated])
}, [setPubKey, setIsAuthenticated])

const handleIsAdmin = useCallback(async () => {
try {
Expand Down Expand Up @@ -112,15 +110,17 @@

await handleAuth()
} catch (error) {
console.log(error)

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/signin.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addTweet.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/topics.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addWebpage.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/checkEnv.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addSource.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addYoutube.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/curationTable/curation.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/trendingTopics/trendingTopics.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/seeLatest/latest.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/sourcesTable/sourcesTable.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/createGeneratedEdges/createGeneratedEdges.cy.ts)

Unexpected console statement

Check warning on line 113 in src/components/Auth/index.tsx

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addNode/addNodeType.cy.ts)

Unexpected console statement
}
}

await updateBudget(setBudget)

await handleIsAdmin()
}

init()
}, [handleAuth, handleIsAdmin])
}, [handleAuth, handleIsAdmin, setBudget])

const message = 'This is a private Graph, Contact Admin'

Expand Down
4 changes: 3 additions & 1 deletion src/network/fetchGraphData/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isDevelopment, isE2E } from '~/constants'
import { api } from '~/network/api'
import { FetchDataResponse } from '~/types'
import { payLsat } from '~/utils'
import { payLsat, updateBudget } from '~/utils'
import { getLSat } from '~/utils/getLSat'

// Main function to fetch graph data
Expand Down Expand Up @@ -30,6 +30,8 @@ const fetchNodes = async (
try {
const response = await api.get<FetchDataResponse>(url, { Authorization: lsatToken }, signal)

updateBudget(setBudget)

return response
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
Expand Down
Loading