Skip to content

Instantly share code, notes, and snippets.

View Karthik-B-06's full-sized avatar
๐Ÿ™
trying to create and solve problems with code

Karthik Karthik-B-06

๐Ÿ™
trying to create and solve problems with code
View GitHub Profile
async driveIconClicked() {
console.log("Clicked");
await gapi.load("auth2", () => {
console.log("Auth2 Loaded");
gapi.auth2.authorize(
{
client_id: this.clientId,
scope: this.scope,
immediate: false
},
handleAuthResult(authResult) {
console.log("Handle Auth result", authResult);
if (authResult && !authResult.error) {
this.oauthToken = authResult.access_token;
this.createPicker();
}
}
createPicker() {
console.log("Create Picker", google.picker);
if (this.pickerApiLoaded && this.oauthToken) {
var picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.addView(google.picker.ViewId.DOCS)
.setOAuthToken(this.oauthToken)
.setDeveloperKey("AIzaSyBaQZlYTmndQYCcdlkHoVtBzpZYandwaaA")
.setCallback(this.pickerCallback)
.build();
async pickerCallback(data) {
console.log("PickerCallback", data);
var url = "nothing";
var name = "nothing";
if (data[google.picker.Response.ACTION] === google.picker.Action.PICKED) {
// Array of Picked Files
console.log(docs);
}
}
mounted() {
let dropBox = document.createElement("script");
dropBox.setAttribute(
"src",
"https://www.dropbox.com/static/api/2/dropins.js"
);
dropBox.setAttribute("id", "dropboxjs");
dropBox.setAttribute("data-app-key", "<YOU_ API_KEY>");
document.head.appendChild(dropBox);
}
let options =
{
// Required. Called when a user selects an item in the Chooser.
success: async files => {
console.log(files);
},
// Optional. Called when the user closes the dialog without selecting a file
// and does not include any parameters.
cancel: function() {},
linkType: "preview",
dropboxIconClicked() {
let options = {
success: async files => {
let attachments = [];
for (let i = 0; i < files.length; i++) {
let attachment = {};
attachment._id = files[i].id;
attachment.title = files[i].name;
attachment.size = files[i].bytes;
attachment.iconURL = files[i].icon;
react-native init <Project Name>
@Karthik-B-06
Karthik-B-06 / userProfile.js
Last active May 2, 2020 11:54
A user profile hook with react-zustand
import create from 'zustand';
const [userProfileStore] = create(set => ({
username: '',
email: '',
user_id: '',
token: '',
user_type: '',
isAuthenticated: false,
token: '',
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<Text>Hello,World !</Text>
</SafeAreaView>
</>
);