Skip to content

Commit

Permalink
update from fetch to axios
Browse files Browse the repository at this point in the history
  • Loading branch information
Codehagen committed Jul 19, 2024
1 parent c584ffb commit 24f7895
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import React, { useState } from "react"
import { deleteWsApiKey } from "@/actions/delete-ws-api-key"
import axios from "axios"
import { toast } from "sonner"

import { Button } from "@dingify/ui/components/button"
Expand Down Expand Up @@ -39,9 +40,9 @@ const ConnectorButton: React.FC<ConnectorButtonProps> = ({
const handleOAuth = async () => {
setIsLoading(true)
try {
const response = await fetch(`/api/oauth/${serviceName}/initiate`)
console.debug("YYY:Fetch URL content:", response)
const data = await response.json()
const response = await axios.get(`/api/oauth/${serviceName}/initiate`)
console.debug("YYY: Axios URL content:", response)
const data = response.data
window.location.href = data.url
} catch (error) {
toast.error(`Error initiating OAuth: ${error.message}`)
Expand Down

0 comments on commit 24f7895

Please sign in to comment.