Last active
July 24, 2020 09:30
-
-
Save shinriyo/464cbb40d1377d6b76d2a93a76a1d491 to your computer and use it in GitHub Desktop.
Revisions
-
shinriyo revised this gist
Jul 24, 2020 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,14 +7,14 @@ export const userOnDeleteForAddSearch = functions.firestore const axios = require('axios'); const documentId = event.id; // needless // const args = { // withCredentials: true, // custom_fields: {}, // headers: { // "Content-Type": "application/json", // } // } // auth is 2nd params. not 3rd! // axios.delete(`${baseURL}/v2/indices/${siteKey}/documents/${documentId}`, args, { -
shinriyo revised this gist
Jul 24, 2020 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,11 +15,10 @@ export const userOnDeleteForAddSearch = functions.firestore } } // auth is 2nd params. not 3rd! // axios.delete(`${baseURL}/v2/indices/${siteKey}/documents/${documentId}`, args, { axios.delete(`${baseURL}/v2/indices/${siteKey}/documents/${documentId}`, { // HTTP Basic Auth auth: { username: siteKey, -
shinriyo revised this gist
Jul 24, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,7 @@ export const userOnDeleteForAddSearch = functions.firestore console.log('documentId:', documentId); console.log('siteKey:', siteKey); console.log('secretKey:', secretKey); axios.delete(`${baseURL}/v2/indices/${siteKey}/documents/${documentId}`, args, { // HTTP Basic Auth auth: { -
shinriyo created this gist
Jul 24, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ import { index, baseURL, siteKey, secretKey } from './index'; import * as functions from 'firebase-functions' export const userOnDeleteForAddSearch = functions.firestore .document('users/{userId}') .onDelete(async (event, context) => { const axios = require('axios'); const documentId = event.id; const args = { withCredentials: true, custom_fields: {}, headers: { "Content-Type": "application/json", } } console.log('documentId:', documentId); console.log('siteKey:', siteKey); console.log('secretKey:', secretKey); // DELETE /v2/indices/{index public key}/documents/{document id} // 対象を消す axios.delete(`${baseURL}/v2/indices/${siteKey}/documents/${documentId}`, args, { // HTTP Basic Auth auth: { username: siteKey, password: secretKey, } }) .then((response: any) => { console.log(response.data) }) .catch((error: any) => { console.log(error) }) .then(function () { console.log("*** finish ***") }) });