Skip to content

Commit

Permalink
fix: proper type for vue files
Browse files Browse the repository at this point in the history
  • Loading branch information
anwarulislam committed Mar 28, 2024
1 parent 17d4e1a commit 5655288
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
Expand Up @@ -131,15 +131,16 @@ const editableCollection = ref<{
watch(
editableCollection,
(updatedEditableCollection) => {
if (props.show) {
if (props.show && props.editingProperties) {
const unsavedCollectionProperties: EditingProperties = {
collection: updatedEditableCollection,
isRootCollection: props.editingProperties?.isRootCollection ?? false,
path: props.editingProperties?.path,
inheritedProperties: props.editingProperties?.inheritedProperties,
}
persistenceService.setLocalConfig(
"unsaved_collection_properties",
JSON.stringify(<EditingProperties>{
collection: updatedEditableCollection,
isRootCollection: props.editingProperties?.isRootCollection,
path: props.editingProperties?.path,
inheritedProperties: props.editingProperties?.inheritedProperties,
})
JSON.stringify(unsavedCollectionProperties)
)
}
},
Expand Down
Expand Up @@ -299,7 +299,7 @@ const selectOAuth2AuthType = () => {
? existingGrantTypeInfo
: defaultGrantTypeInfo
auth.value = <HoppGQLAuth>{
auth.value = {
...auth.value,
authType: "oauth-2",
addTo: "HEADERS",
Expand Down
Expand Up @@ -307,7 +307,7 @@ const selectOAuth2AuthType = () => {
? existingGrantTypeInfo
: defaultGrantTypeInfo
auth.value = <HoppRESTAuth>{
auth.value = {
...auth.value,
authType: "oauth-2",
addTo: "HEADERS",
Expand Down
Expand Up @@ -913,14 +913,16 @@ const generateOAuthToken = async () => {
if (
grantTypesInvolvingRedirect.includes(auth.value.grantTypeInfo.grantType)
) {
const authConfig: PersistedOAuthConfig = {
source: props.source,
context: props.isCollectionProperty
? { type: "collection-properties", metadata: {} }
: { type: "request-tab", metadata: {} },
grant_type: auth.value.grantTypeInfo.grantType,
}
persistenceService.setLocalConfig(
"oauth_temp_config",
JSON.stringify(<PersistedOAuthConfig>{
source: props.source,
context: props.isCollectionProperty
? { type: "collection-properties", metadata: {} }
: { type: "request-tab" },
})
JSON.stringify(authConfig)
)
}
Expand Down
9 changes: 5 additions & 4 deletions packages/hoppscotch-common/src/pages/oauth.vue
Expand Up @@ -93,12 +93,13 @@ onMounted(async () => {
// Indicates the access token generation flow originated from the modal for setting authorization/headers at the collection level
if (context?.type === "collection-properties") {
// Set the access token in `localStorage` to retrieve from the modal while redirecting back
const authConfig: PersistedOAuthConfig = {
...persistedOAuthConfig,
token: tokenInfo.right.access_token,
}
persistenceService.setLocalConfig(
"oauth_temp_config",
JSON.stringify(<PersistedOAuthConfig>{
...persistedOAuthConfig,
token: tokenInfo.right.access_token,
})
JSON.stringify(authConfig)
)
toast.success(t("authorization.oauth.token_fetched_successfully"))
Expand Down

0 comments on commit 5655288

Please sign in to comment.